Skip to main content

PokeList

Struct PokeList 

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

Lets you mutate a list (implements mutable facet_core::ListVTable proxies)

Implementations§

Source§

impl<'mem, 'facet> PokeList<'mem, 'facet>

Source

pub const unsafe fn new(value: Poke<'mem, 'facet>, def: ListDef) -> Self

Creates a new poke list

§Safety

The caller must ensure that def contains valid vtable function pointers that:

  • Correctly implement the list operations for the actual type
  • Do not cause undefined behavior when called
  • Return pointers within valid memory bounds
  • Match the element type specified in def.t()

Violating these requirements can lead to memory safety issues.

Source

pub fn len(&self) -> usize

Get the length of the list

Source

pub fn is_empty(&self) -> bool

Returns true if the list is empty

Source

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

Get an immutable reference to an item from the list at the specified index

Source

pub fn get_mut(&mut self, index: usize) -> Option<Poke<'_, 'facet>>

Get a mutable reference to an item from the list at the specified index

Source

pub fn iter_mut(self) -> PokeListIter<'mem, 'facet>

Returns a mutable iterator over the list

Source

pub const fn def(&self) -> ListDef

Def getter

Source

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

Converts this PokeList back into a Poke

Source

pub fn as_peek_list(&self) -> PeekList<'_, 'facet>

Returns a read-only PeekList view

Trait Implementations§

Source§

impl Debug for PokeList<'_, '_>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'mem, 'facet> IntoIterator for PokeList<'mem, 'facet>

Source§

type Item = Poke<'mem, 'facet>

The type of the elements being iterated over.
Source§

type IntoIter = PokeListIter<'mem, 'facet>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<'mem, 'facet> !UnwindSafe for PokeList<'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.