mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-24 08:11:04 +00:00
20 lines
420 B
Rust
20 lines
420 B
Rust
use crate::url::{Encode, Url};
|
|
|
|
pub struct Display<'a> {
|
|
inner: &'a Url,
|
|
}
|
|
|
|
impl<'a> Display<'a> {
|
|
#[inline]
|
|
pub fn new(inner: &'a Url) -> Self { Self { inner } }
|
|
}
|
|
|
|
impl<'a> std::fmt::Display for Display<'a> {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
let Url { loc, scheme } = self.inner;
|
|
if scheme.is_virtual() {
|
|
Encode::from(self.inner).fmt(f)?;
|
|
}
|
|
loc.display().fmt(f)
|
|
}
|
|
}
|