pub struct ExprArenaWriteGuard<'a> { /* private fields */ }Methods from Deref<Target = ExprArena>§
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn push(&mut self, node: ExprNode) -> ExprId
pub fn push(&mut self, node: ExprNode) -> ExprId
§Panics
Panics if the number of expressions exceeds u32::MAX (expression arena overflow).
pub fn get(&self, id: ExprId) -> &ExprNode
pub fn get_mut(&mut self, id: ExprId) -> &mut ExprNode
pub fn nodes(&self) -> &[ExprNode]
pub fn constant(&mut self, v: f64) -> ExprId
pub fn var(&mut self, v: VarId) -> ExprId
pub fn param(&mut self, p: ParamId) -> ExprId
Sourcepub fn new_param(&mut self, value: f64) -> ParamId
pub fn new_param(&mut self, value: f64) -> ParamId
Allocate a fresh parameter initialized to value, returning its
ParamId. Push a ExprNode::Param with Self::param to reference
it inside an expression.
§Panics
Panics if the number of parameters exceeds u32::MAX.
pub fn num_params(&self) -> usize
Sourcepub fn param_value(&self, p: ParamId) -> f64
pub fn param_value(&self, p: ParamId) -> f64
Current value bound to parameter p.
§Panics
Panics if p was not allocated by Self::new_param on this arena.
Sourcepub fn try_param_value(&self, p: ParamId) -> Option<f64>
pub fn try_param_value(&self, p: ParamId) -> Option<f64>
Look up the value of p, returning None if p is out of range.
Sourcepub fn set_param_value(&mut self, p: ParamId, value: f64)
pub fn set_param_value(&mut self, p: ParamId, value: f64)
Re-bind parameter p to value. Takes effect on the next extraction or
evaluation.
§Panics
Panics if p was not allocated by Self::new_param on this arena.
pub fn linear(&mut self, coeffs: Vec<(VarId, f64)>, constant: f64) -> ExprId
Trait Implementations§
Source§impl Debug for ExprArenaWriteGuard<'_>
impl Debug for ExprArenaWriteGuard<'_>
Source§impl Deref for ExprArenaWriteGuard<'_>
impl Deref for ExprArenaWriteGuard<'_>
Source§impl DerefMut for ExprArenaWriteGuard<'_>
impl DerefMut for ExprArenaWriteGuard<'_>
Source§impl Drop for ExprArenaWriteGuard<'_>
impl Drop for ExprArenaWriteGuard<'_>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ExprArenaWriteGuard<'a>
impl<'a> !Send for ExprArenaWriteGuard<'a>
impl<'a> !UnwindSafe for ExprArenaWriteGuard<'a>
impl<'a> Freeze for ExprArenaWriteGuard<'a>
impl<'a> Sync for ExprArenaWriteGuard<'a>
impl<'a> Unpin for ExprArenaWriteGuard<'a>
impl<'a> UnsafeUnpin for ExprArenaWriteGuard<'a>
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
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> ⓘ
Converts
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> ⓘ
Converts
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