Skip to main content

PokeTuple

Struct PokeTuple 

Source
pub struct PokeTuple<'mem, 'facet> { /* private fields */ }
Expand description

Lets you mutate a tuple’s fields (by index).

Tuples are just tuple-struct types without names, so this is a thin wrapper that exposes ordered field access.

Implementations§

Source§

impl<'mem, 'facet> PokeTuple<'mem, 'facet>

Source

pub const fn len(&self) -> usize

Returns the number of fields in this tuple.

Source

pub const fn is_empty(&self) -> bool

Returns true if this tuple has no fields.

Source

pub const fn ty(&self) -> TupleType

Tuple type information.

Source

pub fn field(&self, index: usize) -> Option<Peek<'_, 'facet>>

Returns a read-only Peek for the field at the given index.

Source

pub fn field_mut( &mut self, index: usize, ) -> Result<Poke<'_, 'facet>, ReflectError>

Returns a mutable Poke for the field at the given index.

Source

pub fn set_field<T: Facet<'facet>>( &mut self, index: usize, value: T, ) -> Result<(), ReflectError>

Sets the value of a field by index.

The value type must match the field’s type.

Returns an error if the parent tuple is not POD. Field mutation could violate tuple-level invariants, so the tuple must be marked with #[facet(pod)] to allow this.

Source

pub const fn into_inner(self) -> Poke<'mem, 'facet>

Converts this back into the underlying Poke.

Source

pub fn as_peek_tuple(&self) -> PeekTuple<'_, 'facet>

Returns a read-only PeekTuple view.

Trait Implementations§

Source§

impl<'mem, 'facet> Debug for PokeTuple<'mem, 'facet>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'mem, 'facet> Freeze for PokeTuple<'mem, 'facet>

§

impl<'mem, 'facet> RefUnwindSafe for PokeTuple<'mem, 'facet>

§

impl<'mem, 'facet> !Send for PokeTuple<'mem, 'facet>

§

impl<'mem, 'facet> !Sync for PokeTuple<'mem, 'facet>

§

impl<'mem, 'facet> Unpin for PokeTuple<'mem, 'facet>

§

impl<'mem, 'facet> UnsafeUnpin for PokeTuple<'mem, 'facet>

§

impl<'mem, 'facet> !UnwindSafe for PokeTuple<'mem, 'facet>

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