Enum Poke

Source
#[non_exhaustive]
pub enum Poke<'mem> { Scalar(PokeValue<'mem>), List(PokeList<'mem>), Map(PokeMap<'mem>), Struct(PokeStruct<'mem>), Enum(PokeEnum<'mem>), Option(PokeOption<'mem>), SmartPointer(PokeSmartPointer<'mem>), }
Expand description

Allows manipulating already-initialized values of different kinds.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Scalar(PokeValue<'mem>)

A scalar value. See PokeValue.

§

List(PokeList<'mem>)

A list (array/vec/etc). See PokeList.

§

Map(PokeMap<'mem>)

A map (HashMap/BTreeMap/etc). See PokeMap.

§

Struct(PokeStruct<'mem>)

A struct, tuple struct, or tuple. See PokeStruct.

§

Enum(PokeEnum<'mem>)

An enum variant. See PokeEnum.

§

Option(PokeOption<'mem>)

An option value. See PokeOption.

§

SmartPointer(PokeSmartPointer<'mem>)

A smart pointer. See PokeSmartPointer.

Implementations§

Source§

impl<'mem> Poke<'mem>

Source

pub unsafe fn unchecked_new(data: Opaque<'mem>, shape: &'static Shape) -> Self

Creates a new peek, for easy manipulation of some opaque data.

§Safety

data must be initialized and well-aligned, and point to a value of the type described by shape.

Source

pub fn borrow<T: Facet>(data: &'mem mut T) -> Poke<'mem>

Borrows the value for a different kind of inspection.

Source

pub fn into_smart_pointer(self) -> PokeSmartPointer<'mem>

Converts this Poke into a PokeSmartPointer, panicking if it’s not a SmartPointer variant

Source

pub fn into_scalar(self) -> PokeValue<'mem>

Converts this Poke into a PokeValue, panicking if it’s not a Scalar variant

Source

pub fn into_list(self) -> PokeList<'mem>

Converts this Poke into a PokeList, panicking if it’s not a List variant

Source

pub fn into_map(self) -> PokeMap<'mem>

Converts this Poke into a PokeMap, panicking if it’s not a Map variant

Source

pub fn into_struct(self) -> PokeStruct<'mem>

Converts this Poke into a PokeStruct, panicking if it’s not a Struct variant

Source

pub fn into_enum(self) -> PokeEnum<'mem>

Converts this Poke into a PokeEnum, panicking if it’s not an Enum variant

Source

pub fn into_option(self) -> PokeOption<'mem>

Converts this Poke into a PokeOption, panicking if it’s not an Option variant

Source

pub fn shape(&self) -> &'static Shape

Get the shape of this Poke.

Auto Trait Implementations§

§

impl<'mem> Freeze for Poke<'mem>

§

impl<'mem> RefUnwindSafe for Poke<'mem>

§

impl<'mem> !Send for Poke<'mem>

§

impl<'mem> !Sync for Poke<'mem>

§

impl<'mem> Unpin for Poke<'mem>

§

impl<'mem> !UnwindSafe for Poke<'mem>

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.