pub struct Model { /* private fields */ }Implementations§
Source§impl Model
impl Model
pub fn new() -> Model
Sourcepub fn add_variable(
&mut self,
name: &str,
variable: Rc<RefCell<Box<Variable>>>,
) -> usize
pub fn add_variable( &mut self, name: &str, variable: Rc<RefCell<Box<Variable>>>, ) -> usize
Adds a variable to the model
If the variable name already exists in the model, the pre-existing variable is replaced
by the variable.
Returns the index of the variable which saves a call to get_variable_index.
pub fn get_variable_index(&self, name: &str) -> Option<usize>
pub fn get_variable_by_index( &self, index: usize, ) -> Option<&Rc<RefCell<Box<Variable>>>>
pub fn get_variable_by_name( &self, name: &str, ) -> Option<&Rc<RefCell<Box<Variable>>>>
pub fn get_most_recently_added(&self) -> Option<&Rc<RefCell<Box<Variable>>>>
pub fn variables_iter(&self) -> VariablesIter<'_>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Model
impl !RefUnwindSafe for Model
impl !Send for Model
impl !Sync for Model
impl Unpin for Model
impl !UnwindSafe for Model
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