Skip to main content

gpui/
shared_uri.rs

1use crate::util::impl_deref;
2
3use crate::SharedString;
4
5/// A [`SharedString`] containing a URI.
6#[derive(Default, PartialEq, Eq, Hash, Clone)]
7pub struct SharedUri(SharedString);
8
9impl_deref!([] SharedUri => mut 0: SharedString);
10
11impl std::fmt::Debug for SharedUri {
12    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13        self.0.fmt(f)
14    }
15}
16
17impl std::fmt::Display for SharedUri {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        write!(f, "{}", self.0.as_ref())
20    }
21}
22
23impl<T: Into<SharedString>> From<T> for SharedUri {
24    fn from(value: T) -> Self {
25        Self(value.into())
26    }
27}