pub struct Mate {
pub kind: MateKind,
pub entities: Vec<MateEntity>,
pub joints: Vec<String>,
}Expand description
A mate: what two entities must be to each other — or, for a coupling,
two joints. Serializes flat: {"type": "distance", "value": 1.0, "entities": [...]}.
One being edited may hold fewer than two entities or joints yet; only a
complete one (Mate::is_complete) holds anything.
Fields§
§kind: MateKind§entities: Vec<MateEntity>§joints: Vec<String>The joints a coupling ties, by their names in the part:
add_part(gear2,m1).
Implementations§
Source§impl Mate
impl Mate
Sourcepub fn constraint(kind: Kind, entities: Vec<MateEntity>) -> Self
pub fn constraint(kind: Kind, entities: Vec<MateEntity>) -> Self
A constraint of kind between entities.
Sourcepub fn joint(kind: JointKind, entities: Vec<MateEntity>) -> Self
pub fn joint(kind: JointKind, entities: Vec<MateEntity>) -> Self
A joint of kind between entities: the first part’s connector,
then the second’s.
Sourcepub fn fixed_here() -> Self
pub fn fixed_here() -> Self
A fixed mate of no entity yet: in a step that places a part, it
holds that part (see AddPart).
Sourcepub fn coupling(kind: CouplingKind, joints: Vec<String>) -> Self
pub fn coupling(kind: CouplingKind, joints: Vec<String>) -> Self
A coupling of kind between the joints named joints.
Sourcepub fn pair(&self) -> Option<[&MateEntity; 2]>
pub fn pair(&self) -> Option<[&MateEntity; 2]>
Its two entities, if it has exactly two.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether it has what it holds together: two entities, or for a coupling two joints.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mate
impl<'de> Deserialize<'de> for Mate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Mate
Auto Trait Implementations§
impl Freeze for Mate
impl RefUnwindSafe for Mate
impl Send for Mate
impl Sync for Mate
impl Unpin for Mate
impl UnsafeUnpin for Mate
impl UnwindSafe for Mate
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