pub struct VariableEnvironment<F> { /* private fields */ }Expand description
Manages variable arrays
See variable.
Implementations§
Source§impl VariableEnvironment<f32>
impl VariableEnvironment<f32>
Source§impl VariableEnvironment<f64>
impl VariableEnvironment<f64>
Source§impl<F: Float> VariableEnvironment<F>
impl<F: Float> VariableEnvironment<F>
pub fn new() -> VariableEnvironment<F>
Source§impl<'env, F: Float> VariableEnvironment<F>
impl<'env, F: Float> VariableEnvironment<F>
Sourcepub fn iter(&self) -> impl Iterator<Item = (VariableID, &RefCell<NdArray<F>>)>
pub fn iter(&self) -> impl Iterator<Item = (VariableID, &RefCell<NdArray<F>>)>
Returns an iterator of the variable arrays and their ids in this env.
Sourcepub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), Box<dyn Error>>
pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), Box<dyn Error>>
Saves the current VariableEnvironment to storage.
Returns the result of the execution.
Sourcepub fn slot(&'env mut self) -> DefaultVariableSlot<'env, F>
pub fn slot(&'env mut self) -> DefaultVariableSlot<'env, F>
Makes a temporary slot for registering a variable array in the default namespace.
Sourcepub fn set<D: Dimension>(&'env mut self, v: Array<F, D>) -> VariableID
pub fn set<D: Dimension>(&'env mut self, v: Array<F, D>) -> VariableID
Registers the given array with the default namespace.
Sourcepub fn name<S: Into<String>>(
&'env mut self,
name: S,
) -> NamedDefaultVariableSlot<'env, F, S>
pub fn name<S: Into<String>>( &'env mut self, name: S, ) -> NamedDefaultVariableSlot<'env, F, S>
Prepares a slot for the default namespace to register a variable array
Sourcepub fn namespace(
&'env self,
namespaceid: &'static str,
) -> VariableNamespace<'env, F>
pub fn namespace( &'env self, namespaceid: &'static str, ) -> VariableNamespace<'env, F>
Get or create a namespace with specified id.
See variable.
Same as Context::namespace.
Sourcepub fn namespace_mut(
&'env mut self,
namespace_id: &'static str,
) -> VariableNamespaceMut<'env, F>
pub fn namespace_mut( &'env mut self, namespace_id: &'static str, ) -> VariableNamespaceMut<'env, F>
Get or create a mutable namespace with specified name.
Return value is used for variable registration. See variable.
Sourcepub fn default_namespace(&'env self) -> VariableNamespace<'env, F>
pub fn default_namespace(&'env self) -> VariableNamespace<'env, F>
Get or create the default namespace.
See variable.
Same as Context::default_namespace.
Sourcepub fn default_namespace_mut(&'env mut self) -> VariableNamespaceMut<'env, F>
pub fn default_namespace_mut(&'env mut self) -> VariableNamespaceMut<'env, F>
Get or create a mutable default namespace.
Return value is used for variable registration.
Sourcepub fn get_array_by_id(&self, vid: VariableID) -> Option<&RefCell<NdArray<F>>>
pub fn get_array_by_id(&self, vid: VariableID) -> Option<&RefCell<NdArray<F>>>
Returns a reference to the variable array with the specified id.
VariableID is returned by the *Slot::set.
Trait Implementations§
Source§impl<F: Clone> Clone for VariableEnvironment<F>
impl<F: Clone> Clone for VariableEnvironment<F>
Source§fn clone(&self) -> VariableEnvironment<F>
fn clone(&self) -> VariableEnvironment<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<F> Freeze for VariableEnvironment<F>
impl<F> !RefUnwindSafe for VariableEnvironment<F>
impl<F> Send for VariableEnvironment<F>where
F: Send,
impl<F> !Sync for VariableEnvironment<F>
impl<F> Unpin for VariableEnvironment<F>
impl<F> UnwindSafe for VariableEnvironment<F>where
F: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more