Skip to main content

PokeSet

Struct PokeSet 

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

Lets you mutate a set (implements mutable facet_core::SetVTable proxies)

Implementations§

Source§

impl<'mem, 'facet> PokeSet<'mem, 'facet>

Source

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

Creates a new poke set

§Safety

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

  • Correctly implement the set 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 number of entries in the set

Source

pub fn is_empty(&self) -> bool

Returns true if the set is empty

Source

pub fn contains(&self, value: &impl Facet<'facet>) -> Result<bool, ReflectError>

Check if the set contains a value

Source

pub fn contains_peek( &self, value: Peek<'_, 'facet>, ) -> Result<bool, ReflectError>

Check if the set contains a value (using a Peek)

Source

pub fn insert<T: Facet<'facet>>( &mut self, value: T, ) -> Result<bool, ReflectError>

Insert a value into the set. Returns true if the value was newly inserted, false if it was already present.

Source

pub fn insert_from_heap<const BORROW: bool>( &mut self, value: HeapValue<'facet, BORROW>, ) -> Result<bool, ReflectError>

Type-erased insert.

Accepts a HeapValue whose shape must match the set’s element type. The value is moved into the set. Returns true if the value was newly inserted.

Source

pub fn iter(&self) -> PeekSetIter<'_, 'facet>

Returns an iterator over the values in the set (read-only).

Source

pub const fn def(&self) -> SetDef

Def getter

Source

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

Converts this PokeSet back into a Poke

Source

pub fn as_peek_set(&self) -> PeekSet<'_, 'facet>

Returns a read-only PeekSet view

Trait Implementations§

Source§

impl<'mem, 'facet> Debug for PokeSet<'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 PokeSet<'mem, 'facet>

§

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

§

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

§

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

§

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

§

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

§

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