Skip to main content

StatePropertyReader

Struct StatePropertyReader 

Source
pub struct StatePropertyReader<'a> { /* private fields */ }
Expand description

Reading handle for properties.

This handle contains the type and the data of a property retrieved from the RetrieveHandle.

Implementations§

Source§

impl<'a> StatePropertyReader<'a>

Source

pub fn new<T: ?Sized>(type_: URID<T>, body: Space<'a>) -> Self

Create a new reading handle with the given type and data.

Source

pub fn type_(&self) -> URID

Return the type of the property.

Source

pub fn body(&self) -> Space<'_>

Return the data of the property.

Source

pub fn read<A: Atom<'a, 'a>>( &self, urid: URID<A>, parameter: A::ReadParameter, ) -> Result<A::ReadHandle, StateErr>

Try to interpret the property as an atom.

This works like any atom reader: You pass the URID of the atom type as well as the type-specific argument, and if the desired type is the actual type of the data, a read handle is returned.

If the desired and actual data types don’t match, Err(StateErr::BadType) is returned.

Auto Trait Implementations§

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.