Struct hotdrink_rs::model::Constraint [−][src]
Represents a constraint in a multiway dataflow constraint system.
It has a name, a set of variables it references, a set of Method
s to enforce it,
and an optional assertion to run to ensure that it is actually enforced upon running a method.
Implementations
impl<T> Constraint<T>
[src]
pub fn new_empty(name: String) -> Self
[src]
Constructs a new Constraint
with no methods.
pub fn new_with_name(name: String, methods: Vec<Method<T>>) -> Self
[src]
Constructs a new Constraint
with the specified name.
pub fn new_with_name_and_assert(
name: String,
methods: Vec<Method<T>>,
assert: Option<Arc<dyn Fn(&[T]) -> bool>>
) -> Self
[src]
name: String,
methods: Vec<Method<T>>,
assert: Option<Arc<dyn Fn(&[T]) -> bool>>
) -> Self
Constructs a new Component
with the specified name and assertion.
pub fn set_active(&mut self, active: bool)
[src]
Enables or disables the constraint.
This decides if the constraint should be enforced during planning.
Trait Implementations
impl<T> Clone for Constraint<T>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> ConstraintSpec for Constraint<T>
[src]
type Method = Method<T>
The type of the methods of the constraint.
fn new(methods: Vec<Self::Method>) -> Self
[src]
fn name(&self) -> &str
[src]
fn methods(&self) -> &[Self::Method]
[src]
fn add_method(&mut self, m: Method<T>)
[src]
fn remove_method(&mut self, name: &str)
[src]
Remove a method from the constraint system.
Panics
Panics if the method does not exit, or if the name is ambiguous.
fn variables(&self) -> &[usize]
[src]
fn is_active(&self) -> bool
[src]
impl<T> Debug for Constraint<T> where
T: Debug,
[src]
T: Debug,
impl<T> Index<&'_ str> for Constraint<T>
[src]
type Output = Method<T>
The returned type after indexing.
fn index(&self, index: &str) -> &Self::Output
[src]
impl<T> PartialEq<Constraint<T>> for Constraint<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for Constraint<T>
impl<T> !Send for Constraint<T>
impl<T> !Sync for Constraint<T>
impl<T> Unpin for Constraint<T>
impl<T> !UnwindSafe for Constraint<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,