pub struct Interned<T: Hash> { /* private fields */ }Expand description
The main type of this crate. Represents a unique, heap-allocated, statically interned value that will exist for the life of the program.
Two instances of Interned for the same value T will always have the same heap memory
address. Additionally, Interned values can be copied freely, since they are merely heap
pointers.
Implementations§
Source§impl<T: Hash + Staticize + DataType<Type = Slice>> Interned<T>
impl<T: Hash + Staticize + DataType<Type = Slice>> Interned<T>
Sourcepub fn interned_slice<'a>(&self) -> &'a [T::SliceValueType]
pub fn interned_slice<'a>(&self) -> &'a [T::SliceValueType]
Returns a the underlying slice interned in this Interned. Calling this method on a
non-slice will panic.
Source§impl Interned<&str>
impl Interned<&str>
Sourcepub fn interned_str<'a>(&self) -> &'a str
pub fn interned_str<'a>(&self) -> &'a str
Returns a reference to the underlying &str interned in this Interned. Calling
this method on a non-string will panic.
Source§impl Interned<&OsStr>
impl Interned<&OsStr>
Sourcepub fn interned_os_str<'a>(&self) -> &'a OsStr
pub fn interned_os_str<'a>(&self) -> &'a OsStr
Returns a reference to the underlying &OsStr interned in this Interned. Calling
this method on a non-OsStr will panic.
Trait Implementations§
Source§impl<T: Hash + Copy + Staticize + DataType + From<Interned<T>>> From<T> for Interned<T::Static>
impl<T: Hash + Copy + Staticize + DataType + From<Interned<T>>> From<T> for Interned<T::Static>
Source§impl<T: Hash + Staticize + Ord + DataType> Ord for Interned<T>
impl<T: Hash + Staticize + Ord + DataType> Ord for Interned<T>
Source§impl<T: Hash + Staticize + PartialOrd + DataType> PartialOrd for Interned<T>
impl<T: Hash + Staticize + PartialOrd + DataType> PartialOrd for Interned<T>
impl<T: Copy + Hash> Copy for Interned<T>
impl<T> Eq for Interned<T>
Auto Trait Implementations§
impl<T> Freeze for Interned<T>
impl<T> RefUnwindSafe for Interned<T>where
T: RefUnwindSafe,
impl<T> !Send for Interned<T>
impl<T> !Sync for Interned<T>
impl<T> Unpin for Interned<T>where
T: Unpin,
impl<T> UnwindSafe for Interned<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more