Struct rf_core::export::Export

source ·
pub struct Export { /* private fields */ }
Expand description

Abstraction for the result of local computation. It is an AST decorated with the computation value.

Implementations§

source§

impl Export

source

pub fn new() -> Self

Create new Export.

Returns

The new Export.

source

pub fn put<A: 'static, F>(&mut self, path: Path, value: F) -> A
where F: Fn() -> A,

Inserts a value in the Export at the given Path.

Arguments
  • path - The Path where to insert the value.
  • value - The value to insert.
Generic Parameters
  • A - The type of the value to insert. It must have a 'static lifetime.
  • F - The type of the function to insert.
Returns

The inserted value.

source

pub fn get<A: 'static + FromStr + Clone>(&self, path: &Path) -> Result<A>

Returns the value at the given Path.

Arguments
  • path - The Path where to get the value.
Generic Parameters
  • A - The type of the value to get to return. It must have a 'static lifetime.
Returns

The value at the given Path.

source

pub fn root<A: 'static + FromStr + Clone>(&self) -> A

Obtain the root value.

Generic Parameters
  • A - The type of the value to return. It must have a 'static lifetime.
Returns

The root value.

Panics
  • Panics if there is not a root value (a value at the empty Path).
  • Panics if the type of the root value is not the same as the type of the requested value.
source

pub fn paths(&self) -> &HashMap<Path, Rc<Box<dyn Any>>>

Returns the HashMap of the Export.

Returns

The HashMap of the Export.

Trait Implementations§

source§

impl Clone for Export

source§

fn clone(&self) -> Export

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Export

source§

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

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

impl<'de> Deserialize<'de> for Export

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Export

source§

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

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

impl From<HashMap<Path, Rc<Box<dyn Any>>>> for Export

source§

fn from(map: HashMap<Path, Rc<Box<dyn Any>>>) -> Self

Converts to this type from the input type.
source§

impl Serialize for Export

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Export

§

impl !Send for Export

§

impl !Sync for Export

§

impl Unpin for Export

§

impl !UnwindSafe for Export

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,