Struct Ref

Source
pub struct Ref<'a, Target: PartialRefTarget + ?Sized> { /* private fields */ }
Expand description

An empty partial reference borrowing no parts.

Partial references with a non-empty set of borrowed parts are built by nesting this type within the Mut and Const types.

Trait Implementations§

Source§

impl<'a, Target: PartialRefTarget> Clone for Ref<'a, Target>

An empty reference contains no mutable parts and thus is safe to clone.

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<'a, Target: PartialRefTarget + ?Sized> HasTarget for Ref<'a, Target>

Source§

type Target = Target

The referenced type.
Source§

impl<'a, 'b: 'a, Target: PartialRefTarget + ?Sized> PartialRef<'a> for Ref<'b, Target>

An empty reference to a valid target is a valid reference.

Source§

unsafe fn from_raw( ptr: *mut <Self::Target as PartialRefTarget>::RawTarget, ) -> Self

Create a partial reference from a raw pointer. Read more
Source§

fn get_raw(&self) -> *mut <Self::Target as PartialRefTarget>::RawTarget

Access to the underlying raw pointer. Read more
Source§

fn borrow<BorrowedRef, SubsetIndex>(&'a mut self) -> BorrowedRef
where BorrowedRef: PartialRef<'a, Target = Self::Target>, Self: HasSubset<'a, BorrowedRef, SubsetIndex>,

Partially re-borrows a partial reference. Read more
Source§

fn part<FieldPartSpec, FieldPart, PartIndex, FieldType>( &'a self, _part: FieldPartSpec, ) -> &'a FieldType
where FieldType: ?Sized, FieldPart: Part<PartType = Field<FieldType>>, FieldPartSpec: PartSpec<FieldPart>, Self: PluckConst<'a, FieldPart, PartIndex>, Self::Target: HasPart<FieldPart> + 'a,

Access a part of the referenced value. Read more
Source§

fn part_mut<FieldPartSpec, FieldPart, PartIndex, FieldType>( &'a mut self, _part: FieldPartSpec, ) -> &'a mut FieldType
where FieldType: ?Sized, FieldPart: Part<PartType = Field<FieldType>>, FieldPartSpec: PartSpec<FieldPart>, Self: PluckMut<'a, FieldPart, PartIndex>, Self::Target: HasPart<FieldPart> + 'a,

Mutable access to a part of the referenced value. Read more
Source§

fn split_borrow<BorrowedRef, SubsetIndex>( &'a mut self, ) -> (BorrowedRef, Self::Remainder)
where BorrowedRef: PartialRef<'a, Target = Self::Target>, Self: HasSubset<'a, BorrowedRef, SubsetIndex>,

Partially re-borrows a partial reference, splitting off the remaining parts. Read more
Source§

fn split_part<FieldPartSpec, FieldPart, PartIndex, FieldType>( &'a mut self, _part: FieldPartSpec, ) -> (&'a FieldType, Self::Remainder)
where FieldType: ?Sized, FieldPart: Part<PartType = Field<FieldType>>, FieldPartSpec: PartSpec<FieldPart>, Self: PluckConst<'a, FieldPart, PartIndex>, Self::Target: HasPart<FieldPart> + 'a,

Access a part of the referenced value, splitting off the remaining parts. Read more
Source§

fn split_part_mut<FieldPartSpec, FieldPart, PartIndex, FieldType>( &'a mut self, _part: FieldPartSpec, ) -> (&'a mut FieldType, Self::Remainder)
where FieldType: ?Sized, FieldPart: Part<PartType = Field<FieldType>>, FieldPartSpec: PartSpec<FieldPart>, Self: PluckMut<'a, FieldPart, PartIndex>, Self::Target: HasPart<FieldPart> + 'a,

Mutable access to a part of the referenced value, splitting off the remaining parts. Read more
Source§

impl<'a, Target: PartialRefTarget> Copy for Ref<'a, Target>

An empty reference contains no mutable parts and thus is safe to clone.

Auto Trait Implementations§

§

impl<'a, Target> Freeze for Ref<'a, Target>
where Target: ?Sized,

§

impl<'a, Target> RefUnwindSafe for Ref<'a, Target>

§

impl<'a, Target> !Send for Ref<'a, Target>

§

impl<'a, Target> !Sync for Ref<'a, Target>

§

impl<'a, Target> Unpin for Ref<'a, Target>
where Target: ?Sized,

§

impl<'a, Target> !UnwindSafe for Ref<'a, Target>

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<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference
where Reference: HasPart<Outer> + ?Sized, Outer: Part<PartType = Field<OuterFieldType>>, Inner: Part, OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,

Source§

unsafe fn part_ptr( ptr: *const <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::Ptr

Given a constant pointer to a target, produce a constant pointer to a part of it. Read more
Source§

unsafe fn part_ptr_mut( ptr: *mut <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::PtrMut

Given a mutable pointer to a target, produce a mutable pointer to a part of it. Read more
Source§

impl<'a, Reference> HasSubset<'a, Ref<'a, <Reference as HasTarget>::Target>, SubsetIndexEnd> for Reference
where Reference: PartialRef<'a>,

Source§

type Remainder = Reference

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