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
impl Export
Sourcepub fn put_lazy<A: 'static, F>(&mut self, path: Path, fun: F)where
F: FnOnce() -> A,
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.
Sourcepub fn put_lazy_and_return<A: 'static + Clone, F>(
&mut self,
path: Path,
fun: F,
) -> Awhere
F: FnOnce() -> A,
pub fn put_lazy_and_return<A: 'static + Clone, F>(
&mut self,
path: Path,
fun: F,
) -> Awhere
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.
Sourcepub fn root<A: 'static + FromStr + Clone>(&self) -> A
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.
Sourcepub fn root_as_result<A: 'static + FromStr + Clone>(&self) -> Result<A>
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Export
impl<'de> Deserialize<'de> for Export
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more