Struct 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>(&mut self, path: Path, value: 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.
Source

pub fn put_lazy<A: 'static, F>(&mut self, path: Path, fun: F)
where F: FnOnce() -> A,

Inserts a value in the Export at the given Path. The value is calculated from the provided function.

§Arguments
  • path - The Path where to insert the value.
  • fun - The function from which we calculate 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 from which the value is calculated.
Source

pub fn put_lazy_and_return<A: 'static + Clone, F>( &mut self, path: Path, fun: F, ) -> A
where F: FnOnce() -> A,

Inserts a value in the Export at the given Path. The value is calculated from the provided function and then returned to the caller.

§Arguments
  • path - The Path where to insert the value.
  • fun - The function from which we calculate 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 from which the value is calculated.
§Returns

The calculated 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. This function may panic, so it is preferable to use the non-panicking counterpart Export::root_as_result

§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 root_as_result<A: 'static + FromStr + Clone>(&self) -> Result<A>

Obtain the root value. This method is the non-panicking version of Export::root

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

A Result containing the root value if present and an error otherwise.

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 Default for Export

Source§

fn default() -> Self

Returns the “default value” for a type. 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 PartialEq for Export

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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 Freeze for Export

§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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§

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

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

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