Struct espr::ir::Instantiables
source · [−]pub struct Instantiables {
pub parts: Vec<PartialComplexEntity>,
}
Expand description
Instantiable subtypes described by a list of partial complex entity, e.g. $[A, B & C]$
This has several operation described in ISO-10303-11 annex B, $+$, $-$, $\And$, and $/$.
- $A + [B_1, B_2] = [B_1, B_2] + A = [A, B_1, B_2]$
let a = PartialComplexEntity::new(&[1]);
let b1 = PartialComplexEntity::new(&[2]);
let b2 = PartialComplexEntity::new(&[3]);
let ce = Instantiables::new(&[b1.clone(), b2.clone()]);
assert_eq!(a.clone() + ce, Instantiables::new(&[
a.clone(),
b1.clone(),
b2.clone(),
]));
- $A \And [B_1, B_2] = [B_1, B_2] \And A = [A \And B_1, A \And B_2]$
let a = PartialComplexEntity::new(&[1]);
let b1 = PartialComplexEntity::new(&[2]);
let b2 = PartialComplexEntity::new(&[3]);
let ce = Instantiables::new(&[b1.clone(), b2.clone()]);
assert_eq!(a.clone() & ce, Instantiables::new(&[
a.clone() & b1.clone(),
a.clone() & b2.clone(),
]));
- $[A_1, A_2] + [B_1, B_2] = [A_1, A_2, B_1, B_2]$
let a1 = PartialComplexEntity::new(&[1]);
let a2 = PartialComplexEntity::new(&[2]);
let b1 = PartialComplexEntity::new(&[3]);
let b2 = PartialComplexEntity::new(&[4]);
let ce1 = Instantiables::new(&[a1.clone(), a2.clone()]);
let ce2 = Instantiables::new(&[b1.clone(), b2.clone()]);
assert_eq!(ce1 + ce2, Instantiables::new(&[
a1.clone(),
a2.clone(),
b1.clone(),
b2.clone(),
]));
- $[A_1, A_2] \And [B_1, B_2] = [A_1 \And B_1, A_1 \And B_2, A_2 \And B_1, A_2 \And B_2]$
let a1 = PartialComplexEntity::new(&[1]);
let a2 = PartialComplexEntity::new(&[2]);
let b1 = PartialComplexEntity::new(&[3]);
let b2 = PartialComplexEntity::new(&[4]);
let ce1 = Instantiables::new(&[a1.clone(), a2.clone()]);
let ce2 = Instantiables::new(&[b1.clone(), b2.clone()]);
assert_eq!(ce1 & ce2, Instantiables::new(&[
a1.clone() & b1.clone(),
a1.clone() & b2.clone(),
a2.clone() & b1.clone(),
a2.clone() & b2.clone(),
]));
- $[A, A \And B, A \And C, A \And B \And D, B \And C, D] / A = [A, A \And B, A \And C, A \And B \And D]$
let a = PartialComplexEntity::new(&[1]);
let b = PartialComplexEntity::new(&[2]);
let c = PartialComplexEntity::new(&[3]);
let d = PartialComplexEntity::new(&[4]);
let ce = Instantiables::new(&[
a.clone(),
a.clone() & b.clone(),
a.clone() & c.clone(),
a.clone() & b.clone() & d.clone(),
b.clone() & c.clone(),
d.clone()
]);
assert_eq!(ce / a.clone(), Instantiables::new(&[
a.clone(),
a.clone() & b.clone(),
a.clone() & c.clone(),
a.clone() & b.clone() & d.clone(),
]));
- $ [A, A \And B, A \And C, A \And B \And D, B \And C, D]/[B, D] = [A \And B, A \And B \And D, B \And C, D] $
let a = PartialComplexEntity::new(&[1]);
let b = PartialComplexEntity::new(&[2]);
let c = PartialComplexEntity::new(&[3]);
let d = PartialComplexEntity::new(&[4]);
let ce1 = Instantiables::new(&[
a.clone(),
a.clone() & b.clone(),
a.clone() & c.clone(),
a.clone() & b.clone() & d.clone(),
b.clone() & c.clone(),
d.clone()
]);
let ce2 = Instantiables::new(&[
b.clone(),
d.clone()
]);
assert_eq!(ce1 / ce2, Instantiables::new(&[
a.clone() & b.clone(),
a.clone() & b.clone() & d.clone(),
b.clone() & c.clone(),
d.clone()
]));
- $[A_1, A_2, B_1, B_2] − [A_2, B_1] = [A_1, B_2]$
let a1 = PartialComplexEntity::new(&[1]);
let a2 = PartialComplexEntity::new(&[2]);
let b1 = PartialComplexEntity::new(&[3]);
let b2 = PartialComplexEntity::new(&[4]);
let ce1 = Instantiables::new(&[
a1.clone(),
a2.clone(),
b1.clone(),
b2.clone(),
]);
let ce2 = Instantiables::new(&[
a2.clone(),
b1.clone()
]);
assert_eq!(ce1 - ce2, Instantiables::new(&[
a1.clone(),
b2.clone()
]));
Fields
parts: Vec<PartialComplexEntity>
Sorted and non-duplicated list of partial complex entities
Implementations
sourceimpl Instantiables
impl Instantiables
pub fn new(pces: &[PartialComplexEntity]) -> Self
sourcepub fn andor(factors: Vec<Self>) -> Self
pub fn andor(factors: Vec<Self>) -> Self
A ANDOR B ANDOR C -> [A, B, C, A & B, B & C, A & C, A & B & C]
pub fn from_constraint_expr(
ns: &Namespace<'_>,
expr: &ConstraintExpr
) -> Result<Self, SemanticError>
Trait Implementations
sourceimpl Add<Instantiables> for Instantiables
impl Add<Instantiables> for Instantiables
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the +
operator.
sourcefn add(self, rhs: Instantiables) -> Self
fn add(self, rhs: Instantiables) -> Self
Performs the +
operation. Read more
sourceimpl Add<Instantiables> for PartialComplexEntity
impl Add<Instantiables> for PartialComplexEntity
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the +
operator.
sourcefn add(self, rhs: Instantiables) -> Instantiables
fn add(self, rhs: Instantiables) -> Instantiables
Performs the +
operation. Read more
sourceimpl Add<PartialComplexEntity> for Instantiables
impl Add<PartialComplexEntity> for Instantiables
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the +
operator.
sourcefn add(self, rhs: PartialComplexEntity) -> Self
fn add(self, rhs: PartialComplexEntity) -> Self
Performs the +
operation. Read more
sourceimpl BitAnd<Instantiables> for Instantiables
impl BitAnd<Instantiables> for Instantiables
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the &
operator.
sourcefn bitand(self, rhs: Instantiables) -> Instantiables
fn bitand(self, rhs: Instantiables) -> Instantiables
Performs the &
operation. Read more
sourceimpl BitAnd<Instantiables> for PartialComplexEntity
impl BitAnd<Instantiables> for PartialComplexEntity
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the &
operator.
sourcefn bitand(self, rhs: Instantiables) -> Instantiables
fn bitand(self, rhs: Instantiables) -> Instantiables
Performs the &
operation. Read more
sourceimpl BitAnd<PartialComplexEntity> for Instantiables
impl BitAnd<PartialComplexEntity> for Instantiables
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the &
operator.
sourcefn bitand(self, q: PartialComplexEntity) -> Instantiables
fn bitand(self, q: PartialComplexEntity) -> Instantiables
Performs the &
operation. Read more
sourceimpl Clone for Instantiables
impl Clone for Instantiables
sourcefn clone(&self) -> Instantiables
fn clone(&self) -> Instantiables
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Instantiables
impl Debug for Instantiables
sourceimpl Default for Instantiables
impl Default for Instantiables
sourcefn default() -> Instantiables
fn default() -> Instantiables
Returns the “default value” for a type. Read more
sourceimpl Div<Instantiables> for Instantiables
impl Div<Instantiables> for Instantiables
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the /
operator.
sourcefn div(self, rhs: Instantiables) -> Self
fn div(self, rhs: Instantiables) -> Self
Performs the /
operation. Read more
sourceimpl Div<PartialComplexEntity> for Instantiables
impl Div<PartialComplexEntity> for Instantiables
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the /
operator.
sourcefn div(self, rhs: PartialComplexEntity) -> Instantiables
fn div(self, rhs: PartialComplexEntity) -> Instantiables
Performs the /
operation. Read more
sourceimpl<'a> FromIterator<&'a PartialComplexEntity> for Instantiables
impl<'a> FromIterator<&'a PartialComplexEntity> for Instantiables
sourcefn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = &'a PartialComplexEntity>,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = &'a PartialComplexEntity>,
Creates a value from an iterator. Read more
sourceimpl PartialEq<Instantiables> for Instantiables
impl PartialEq<Instantiables> for Instantiables
sourcefn eq(&self, other: &Instantiables) -> bool
fn eq(&self, other: &Instantiables) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Instantiables) -> bool
fn ne(&self, other: &Instantiables) -> bool
This method tests for !=
.
sourceimpl Sub<Instantiables> for Instantiables
impl Sub<Instantiables> for Instantiables
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: Instantiables) -> Self
fn sub(self, rhs: Instantiables) -> Self
Performs the -
operation. Read more
sourceimpl Sub<PartialComplexEntity> for Instantiables
impl Sub<PartialComplexEntity> for Instantiables
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the -
operator.
sourcefn sub(self, q: PartialComplexEntity) -> Self
fn sub(self, q: PartialComplexEntity) -> Self
Performs the -
operation. Read more
impl Eq for Instantiables
impl StructuralEq for Instantiables
impl StructuralPartialEq for Instantiables
Auto Trait Implementations
impl RefUnwindSafe for Instantiables
impl Send for Instantiables
impl Sync for Instantiables
impl Unpin for Instantiables
impl UnwindSafe for Instantiables
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more