InternedSliceRef

Struct InternedSliceRef 

Source
#[repr(transparent)]
pub struct InternedSliceRef<'a, T> { ptr: NonNull<c_void>, _marker: PhantomData<&'a T>, }

Fields§

§ptr: NonNull<c_void>

§Invariant

There is no ThinArcBorrow unfortunately, so this is basically a ManuallyDrop<ThinArc>, except that can’t be Copy, so we store a raw pointer instead.

§_marker: PhantomData<&'a T>

Implementations§

Source§

impl<'a, T: SliceInternable> InternedSliceRef<'a, T>

Source

fn arc(self) -> ManuallyDrop<ThinArc<T::Header, T::SliceType>>

Source

pub fn to_owned(self) -> InternedSlice<T>

Source

pub fn get( self, ) -> &'a HeaderSlice<HeaderWithLength<<T as SliceInternable>::Header>, [<T as SliceInternable>::SliceType]>

Source

pub unsafe fn decrement_refcount(self)

§Safety

You have to make sure the data is not referenced after the refcount reaches zero; beware the interning map also keeps a reference to the value.

Source

pub(crate) fn strong_count(self) -> usize

Source

pub(crate) fn as_raw(self) -> *const c_void

Source

pub fn change_lifetime<'b>(self) -> InternedSliceRef<'b, T>

Available only on GC mode.

Changes the attached lifetime, as in GC mode, the lifetime is more kind of a lint to prevent misuse than actual soundness check.

Trait Implementations§

Source§

impl<T> Clone for InternedSliceRef<'_, T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for InternedSliceRef<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: SliceInternable> Deref for InternedSliceRef<'_, T>

Source§

type Target = HeaderSlice<HeaderWithLength<<T as SliceInternable>::Header>, [<T as SliceInternable>::SliceType]>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: SliceInternable> Hash for InternedSliceRef<'_, T>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: SliceInternable> PartialEq for InternedSliceRef<'_, T>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Copy for InternedSliceRef<'_, T>

Source§

impl<T: SliceInternable> Eq for InternedSliceRef<'_, T>

Source§

impl<T: Send + Sync> Send for InternedSliceRef<'_, T>

Source§

impl<T: Send + Sync> Sync for InternedSliceRef<'_, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for InternedSliceRef<'a, T>

§

impl<'a, T> RefUnwindSafe for InternedSliceRef<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Unpin for InternedSliceRef<'a, T>

§

impl<'a, T> UnwindSafe for InternedSliceRef<'a, T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.