pub struct Variable {
pub terms: HashMap<String, Term>,
/* private fields */
}Expand description
A crisp variable with an inclusive numeric domain and a set of named terms.
Fields§
§terms: HashMap<String, Term>Mapping from term name to its labeled membership function wrapper.
Implementations§
Source§impl Variable
impl Variable
Sourcepub fn new(min: Float, max: Float) -> Result<Self>
pub fn new(min: Float, max: Float) -> Result<Self>
Constructs a new variable, validating that min < max.
Sourcepub fn insert_term(&mut self, name: &str, t: Term) -> Result<()>
pub fn insert_term(&mut self, name: &str, t: Term) -> Result<()>
Inserts a named term; rejects empty names and duplicates.
- Empty name ->
FuzzyError::EmptyInput - Duplicate name ->
FuzzyError::TypeMismatch
Sourcepub fn get(&self, name: &str) -> Option<&Term>
pub fn get(&self, name: &str) -> Option<&Term>
Returns a reference to the term for name, if present.
Auto Trait Implementations§
impl Freeze for Variable
impl !RefUnwindSafe for Variable
impl Send for Variable
impl Sync for Variable
impl Unpin for Variable
impl !UnwindSafe for Variable
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