Struct Ref

Source
pub struct Ref<T, B: ?Sized = T> { /* private fields */ }

Implementations§

Source§

impl<T, B> Ref<T, [B]>

Source

pub fn get(this: Self, index: usize) -> Option<Ref<T, B>>

Source

pub fn range(this: Self, range: Range<usize>) -> Option<Ref<T, [B]>>

Source

pub fn first(this: Self) -> Option<Ref<T, B>>

Source

pub fn skip_first(this: Self) -> Option<Ref<T, [B]>>

Source

pub fn split_first(this: Self) -> Option<(Ref<T, B>, Ref<T, [B]>)>

Source

pub fn split_at(this: Self, mid: usize) -> (Ref<T, [B]>, Ref<T, [B]>)

Source

pub fn split_at_checked( this: Self, mid: usize, ) -> Result<(Ref<T, [B]>, Ref<T, [B]>), Self>

Source

pub fn chunk_by<F: for<'a> FnMut(&'a B, &'a B) -> bool>( this: Self, f: F, ) -> ChunkBy<T, B, F>

Source

pub fn chunks(this: Self, size: usize) -> Chunks<T, B>

Source

pub fn split<F: for<'a> FnMut(&'a B) -> bool>( this: Self, f: F, ) -> Split<T, B, F>

Source

pub fn split_inclusive<F: for<'a> FnMut(&'a B) -> bool>( this: Self, f: F, ) -> SplitInclusive<T, B, F>

Source

pub fn windows(this: Self, size: usize) -> Windows<T, B>

Source§

impl<T> Ref<T, ()>

Source

pub fn destructure(self)

Source§

impl<T, B0> Ref<T, (B0,)>

Source

pub fn destructure(self) -> (Ref<T, B0>,)

Source§

impl<T, B0, B1> Ref<T, (B0, B1)>

Source

pub fn destructure(self) -> (Ref<T, B0>, Ref<T, B1>)

Source§

impl<T, B0, B1, B2> Ref<T, (B0, B1, B2)>

Source

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)>

Source

pub fn destructure(self) -> (Ref<T, B0>, Ref<T, B1>, Ref<T, B2>, Ref<T, B3>)

Source§

impl<T, B: ?Sized> Ref<T, B>

Source

pub fn downgrade(&self) -> Weak<T, B>

Source

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

Source

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

Source

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

Source

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

Source

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

Trait Implementations§

Source§

impl<T, B: ?Sized> Clone for Ref<T, B>

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, B: ?Sized> Deref for Ref<T, B>

Source§

type Target = B

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<T, B: ?Sized> From<RefMut<T, B>> for Ref<T, B>

Source§

fn from(value: RefMut<T, B>) -> Self

Converts to this type from the input type.
Source§

impl<T, B> IntoIterator for Ref<T, [B]>

Source§

type Item = Ref<T, B>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<T, B>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: Send, B: ?Sized + Sync> Send for Ref<T, B>

Source§

impl<T: Send, B: ?Sized + Sync> Sync for Ref<T, B>

Auto Trait Implementations§

§

impl<T, B> Freeze for Ref<T, B>
where B: ?Sized,

§

impl<T, B = T> !RefUnwindSafe for Ref<T, B>

§

impl<T, B> Unpin for Ref<T, B>
where B: ?Sized,

§

impl<T, B = T> !UnwindSafe for Ref<T, B>

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
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<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.