Struct Const

Source
pub struct Const<Part, Reference: HasTarget> { /* private fields */ }
Expand description

A constant (immutable) part of a partial reference.

Trait Implementations§

Source§

impl<SomePart, Reference: Copy + HasTarget> Clone for Const<SomePart, Reference>

A reference containing just constant parts 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, SomePart: Part, Reference: PartialRef<'a>> HasTarget for Const<SomePart, Reference>
where Reference::Target: HasPart<SomePart>,

Source§

type Target = <Reference as HasTarget>::Target

The referenced type.
Source§

impl<'a, SomePart: Part, Reference: PartialRef<'a>> PartialRef<'a> for Const<SomePart, Reference>
where Reference::Target: HasPart<SomePart>,

Extending a valid reference by a constant part is still a valid reference when the reference target has such a part.

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, ContainingPart, PluckedOuter, PluckedInner, Reference, NestedPartIndex, Index, OuterFieldType, ContainingFieldType> PluckConst<'a, Nested<PluckedOuter, PluckedInner>, IndexSplit<NestedPartIndex, Index>> for Const<ContainingPart, Reference>
where PluckedOuter: Part<PartType = Field<OuterFieldType>>, PluckedInner: Part, ContainingPart: Part<PartType = Field<ContainingFieldType>> + ContainsNestedPart<PluckedOuter, NestedPartIndex>, ContainingFieldType: SplitIntoParts<'a, ContainingPart, Reference> + ?Sized, ContainingFieldType::ResultMut: PluckConst<'a, Nested<PluckedOuter, PluckedInner>, Index>, OuterFieldType: ?Sized + HasPart<PluckedInner> + PartialRefTarget<RawTarget = OuterFieldType>, Reference: PartialRef<'a>, Reference::Target: HasPart<ContainingPart>,

(internal) Pluck a constant nested subpart of the constant first part.

Source§

type Remainder = Const<ContainingPart, Reference>

The partial reference left after plucking.
Source§

impl<'a, PluckedPart, Reference> PluckConst<'a, PluckedPart, IndexHere> for Const<PluckedPart, Reference>
where PluckedPart: Part, Reference: PartialRef<'a>, Reference::Target: HasPart<PluckedPart>,

(internal) Plucks the outermost constant part.

Source§

type Remainder = Const<PluckedPart, Reference>

The partial reference left after plucking.
Source§

impl<'a, PluckedPart, SkippedPart, Reference, Index> PluckConst<'a, PluckedPart, IndexNext<Index>> for Const<SkippedPart, Reference>
where PluckedPart: Part, SkippedPart: Part, Reference::Target: HasPart<PluckedPart> + HasPart<SkippedPart>, Reference: PluckConst<'a, PluckedPart, Index>,

(internal) Skips the constant first part while plucking a constant part.

Source§

type Remainder = Const<SkippedPart, <Reference as PluckConst<'a, PluckedPart, Index>>::Remainder>

The partial reference left after plucking.
Source§

impl<'a, PluckedPart, SkippedPart, Reference, Index> PluckMut<'a, PluckedPart, IndexNext<Index>> for Const<SkippedPart, Reference>
where PluckedPart: Part, SkippedPart: Part, Reference::Target: HasPart<PluckedPart> + HasPart<SkippedPart>, Reference: PluckMut<'a, PluckedPart, Index>,

(internal) Skips the constant first part while plucking a mutable part.

Source§

type Remainder = Const<SkippedPart, <Reference as PluckMut<'a, PluckedPart, Index>>::Remainder>

The partial reference left after plucking.
Source§

impl<SomePart, Reference: Copy + HasTarget> Copy for Const<SomePart, Reference>

A reference containing just constant parts is safe to clone.

Auto Trait Implementations§

§

impl<Part, Reference> Freeze for Const<Part, Reference>

§

impl<Part, Reference> RefUnwindSafe for Const<Part, Reference>
where <<Reference as HasTarget>::Target as PartialRefTarget>::RawTarget: RefUnwindSafe, Reference: RefUnwindSafe, Part: RefUnwindSafe,

§

impl<Part, Reference> !Send for Const<Part, Reference>

§

impl<Part, Reference> !Sync for Const<Part, Reference>

§

impl<Part, Reference> Unpin for Const<Part, Reference>
where Reference: Unpin, Part: Unpin,

§

impl<Part, Reference> UnwindSafe for Const<Part, Reference>
where <<Reference as HasTarget>::Target as PartialRefTarget>::RawTarget: RefUnwindSafe, Reference: UnwindSafe, Part: UnwindSafe,

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, SubsetPart, Reference, PluckedRef, PartIndex, TailIndex> HasSubset<'a, Const<SubsetPart, Reference>, SubsetIndexCons<PartIndex, TailIndex>> for PluckedRef
where PluckedRef: PluckConst<'a, SubsetPart, PartIndex>, <PluckedRef as PluckConst<'a, SubsetPart, PartIndex>>::Remainder: HasSubset<'a, Reference, TailIndex>, Reference: HasTarget,

Source§

type Remainder = <<PluckedRef as PluckConst<'a, SubsetPart, PartIndex>>::Remainder as HasSubset<'a, Reference, TailIndex>>::Remainder

Source§

impl<'a, SubsetPart, Reference, PluckedRef, PartIndex, TailIndex> HasSubset<'a, Mut<SubsetPart, Reference>, SubsetIndexCons<PartIndex, TailIndex>> for PluckedRef
where PluckedRef: PluckMut<'a, SubsetPart, PartIndex>, <PluckedRef as PluckMut<'a, SubsetPart, PartIndex>>::Remainder: HasSubset<'a, Reference, TailIndex>, Reference: HasTarget,

Source§

type Remainder = <<PluckedRef as PluckMut<'a, SubsetPart, PartIndex>>::Remainder as HasSubset<'a, Reference, TailIndex>>::Remainder

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.