Expand description
Represents the genders of an entire family with parents and children.
A Family consists of parents and children, each either a single or two persons as
expressed by the OneOrTwo
struct.
E.g.:
- one parent & one child: 👨👦
- two parents & one child: 👨👨👦
- one parent & two children: 👩👧👦
- and so on…
To get a Family
value, it is recommended to use any of the From
impls e.g.:
// From<(Gender,Gender)>
assert_eq!(
Family {
parents: OneOrTwo::One(Gender::Male),
children: OneOrTwo::One(Gender::Male),
},
(Gender::Male,Gender::Male).into()
);
// From<(Pair,Pair)>
assert_eq!(
Family {
parents: OneOrTwo::Two(Pair::Males),
children: OneOrTwo::Two(Pair::Males),
},
(Pair::Males,Pair::Males).into()
);
Or use the with_children
composer of Gender
and Pair
:
// Gender::with_children
assert_eq!(
Family {
parents: OneOrTwo::One(Gender::Male),
children: OneOrTwo::One(Gender::Male),
},
Gender::Male.with_children(Gender::Male)
);
// Pair::with_children
assert_eq!(
Family {
parents: OneOrTwo::Two(Pair::Males),
children: OneOrTwo::Two(Pair::Males),
},
Pair::Males.with_children(Pair::Males)
);
Fields
parents: OneOrTwo
children: OneOrTwo
Trait Implementations
sourceimpl Ord for Family
impl Ord for Family
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Family> for Family
impl PartialOrd<Family> for Family
sourcefn partial_cmp(&self, other: &Family) -> Option<Ordering>
fn partial_cmp(&self, other: &Family) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Family
impl Eq for Family
impl StructuralEq for Family
impl StructuralPartialEq for Family
Auto Trait Implementations
impl RefUnwindSafe for Family
impl Send for Family
impl Sync for Family
impl Unpin for Family
impl UnwindSafe for Family
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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