Expand description
Represents one’s or two person’s gender while defining whether it’s one or two.
Actually, this attribute is not used as such by any emoji, instead, it is used to compose
a Family
, which consists of two OneOrTwo
structs.
E.g. one: 👨👦 (parent), two: 👨👨👦 (parents)
To get a OneOrTwo
value, it is recommended to use any of the From
impls e.g.:
// From<Gender>
assert_eq!(OneOrTwo::One(Gender::Male), Gender::Male.into());
// From<Pair>
assert_eq!(OneOrTwo::Two(Pair::Males), Pair::Males.into());
Variants
One(Gender)
Only one person
Two(Pair)
Two people
Implementations
sourceimpl OneOrTwo
impl OneOrTwo
sourcepub fn with_children(self, children: impl Into<OneOrTwo>) -> Family
pub fn with_children(self, children: impl Into<OneOrTwo>) -> Family
Family
composer using self
as parents
sourcepub const fn name_adults(self) -> &'static str
pub const fn name_adults(self) -> &'static str
Descriptive name of this attribute variant
sourcepub const fn name_children(self) -> &'static str
pub const fn name_children(self) -> &'static str
Descriptive name of this attribute variant
Trait Implementations
sourceimpl Ord for OneOrTwo
impl Ord for OneOrTwo
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<OneOrTwo> for OneOrTwo
impl PartialOrd<OneOrTwo> for OneOrTwo
sourcefn partial_cmp(&self, other: &OneOrTwo) -> Option<Ordering>
fn partial_cmp(&self, other: &OneOrTwo) -> 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 OneOrTwo
impl Eq for OneOrTwo
impl StructuralEq for OneOrTwo
impl StructuralPartialEq for OneOrTwo
Auto Trait Implementations
impl RefUnwindSafe for OneOrTwo
impl Send for OneOrTwo
impl Sync for OneOrTwo
impl Unpin for OneOrTwo
impl UnwindSafe for OneOrTwo
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