pub struct Ref<T, B: ?Sized = T> { /* private fields */ }
Implementations§
Source§impl<T, B> Ref<T, [B]>
impl<T, B> Ref<T, [B]>
pub fn get(this: Self, index: usize) -> Option<Ref<T, B>>
pub fn range(this: Self, range: Range<usize>) -> Option<Ref<T, [B]>>
pub fn first(this: Self) -> Option<Ref<T, B>>
pub fn skip_first(this: Self) -> Option<Ref<T, [B]>>
pub fn split_first(this: Self) -> Option<(Ref<T, B>, Ref<T, [B]>)>
pub fn split_at(this: Self, mid: usize) -> (Ref<T, [B]>, Ref<T, [B]>)
pub fn split_at_checked( this: Self, mid: usize, ) -> Result<(Ref<T, [B]>, Ref<T, [B]>), Self>
pub fn chunk_by<F: for<'a> FnMut(&'a B, &'a B) -> bool>( this: Self, f: F, ) -> ChunkBy<T, B, F> ⓘ
pub fn chunks(this: Self, size: usize) -> Chunks<T, B> ⓘ
pub fn split<F: for<'a> FnMut(&'a B) -> bool>( this: Self, f: F, ) -> Split<T, B, F> ⓘ
pub fn split_inclusive<F: for<'a> FnMut(&'a B) -> bool>( this: Self, f: F, ) -> SplitInclusive<T, B, F> ⓘ
pub fn windows(this: Self, size: usize) -> Windows<T, B> ⓘ
Source§impl<T, B0, B1, B2> Ref<T, (B0, B1, B2)>
impl<T, B0, B1, B2> Ref<T, (B0, B1, B2)>
pub fn destructure(self) -> (Ref<T, B0>, Ref<T, B1>, Ref<T, B2>)
Source§impl<T, B0, B1, B2, B3> Ref<T, (B0, B1, B2, B3)>
impl<T, B0, B1, B2, B3> Ref<T, (B0, B1, B2, B3)>
Source§impl<T, B: ?Sized> Ref<T, B>
impl<T, B: ?Sized> Ref<T, B>
pub fn downgrade(&self) -> Weak<T, B>
Sourcepub fn map<C: ?Sized>(self, f: impl for<'a> FnOnce(&'a B) -> &'a C) -> Ref<T, C>
pub fn map<C: ?Sized>(self, f: impl for<'a> FnOnce(&'a B) -> &'a C) -> Ref<T, C>
Given that f
works for all lifetimes 'a
, it will also work for
the indeterminable, yet existant, lifetime of the BorrowInner
.
§Experimental
This is intended to be a safe API, and I believe that it is safe, however the work to prove this thoroughly is complex and has not yet been undertaken. This work will be done before v1.0.0.
Do not rely on this being safe in safety critical contexts
Sourcepub fn context<R>(self, f: impl for<'a> FnOnce(&'a B, Context<'a, T>) -> R) -> R
pub fn context<R>(self, f: impl for<'a> FnOnce(&'a B, Context<'a, T>) -> R) -> R
Uses the same principle behind other scoping APIs to provide additional support to specific lifetimes.
The lifetime in question here is the same 'a
as referenced in Ref::map
, as the true 'a
can not be know
the lifetime '_
will be used as a stand_in as it is truly anonymous.
§Experimental
This is intended to be a safe API, and I believe that it is safe, however the work to prove this thoroughly is complex and has not yet been undertaken. This work will be done before v1.0.0.
Do not rely on this being safe in safety critical contexts
Sourcepub async fn scope<F: Future>(
self,
f: impl for<'a> FnOnce(&'a B, Context<'a, T>, Spawner<'a>) -> F,
) -> F::Output
pub async fn scope<F: Future>( self, f: impl for<'a> FnOnce(&'a B, Context<'a, T>, Spawner<'a>) -> F, ) -> F::Output
Uses the same principle behind other scoping APIs to provide additional support to specific lifetimes.
The lifetime in question here is the same 'a
as referenced in Ref::map
, as the true 'a
can not be know
the lifetime '_
will be used as a stand_in as it is truly anonymous.
§Experimental
This is intended to be a safe API, and I believe that it is safe, however the work to prove this thoroughly is complex and has not yet been undertaken. This work will be done before v1.0.0.
Do not rely on this being safe in safety critical contexts
Sourcepub fn into_deref(self) -> Ref<T, B::Target>where
B: Deref,
pub fn into_deref(self) -> Ref<T, B::Target>where
B: Deref,
A special case of Ref::map
to handle dereferencing.
§Experimental
This is intended to be a safe API, and I believe that it is safe, however the work to prove this thoroughly is complex and has not yet been undertaken. This work will be done before v1.0.0.
Do not rely on this being safe in safety critical contexts
Sourcepub fn into_borrow<C>(self) -> Ref<T, C>where
B: Borrow<C>,
pub fn into_borrow<C>(self) -> Ref<T, C>where
B: Borrow<C>,
A special case of Ref::map
to handle borrowing.
§Experimental
This is intended to be a safe API, and I believe that it is safe, however the work to prove this thoroughly is complex and has not yet been undertaken. This work will be done before v1.0.0.
Do not rely on this being safe in safety critical contexts