zed/crates/gpui/src/shared_uri.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
627 B
Rust
Raw Normal View History

use derive_more::{Deref, DerefMut};
use crate::SharedString;
/// A [`SharedString`] containing a URI.
#[derive(Deref, DerefMut, Default, PartialEq, Eq, Hash, Clone)]
pub struct SharedUri(SharedString);
impl std::fmt::Debug for SharedUri {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.0.fmt(f)
}
}
impl std::fmt::Display for SharedUri {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.as_ref())
}
}
impl<T: Into<SharedString>> From<T> for SharedUri {
fn from(value: T) -> Self {
Self(value.into())
}
}