pub struct With<M, T: 'static> {
pub default: T,
/* private fields */
}
Expand description
Customizable emoji composer.
This struct contains a set of Emoji
which can be differentiated by an attribute M
such as
Tone
, Gender
, and Hair
. Depending on the attribute type this struct provides
customization functions such as With::tone
, With::gender
, and With::hair
,
respectively.
Notice unlike the WithNoDef
, this struct has an default variant and thus Deref
s to T
,
and implements Display
if T
does.
Fields
default: T
Implementations
sourceimpl<T> With<Tone, T>
impl<T> With<Tone, T>
sourceimpl<T> With<TonePair, T>
impl<T> With<TonePair, T>
Customizing by TonePair
.
Notice that Tone
and (Tone, Tone)
both implement Into<TonePair>
.
Examples
assert_eq!(COUPLE_WITH_HEART.to_string(), "💑"); // default, derefs directly to `Emoji`
assert_eq!(COUPLE_WITH_HEART.tone(Tone::Medium).to_string(), "💑🏽"); // Same skin tone
assert_eq!(COUPLE_WITH_HEART.tone((Tone::Light, Tone::Dark)).to_string(), "🧑🏻❤️🧑🏿"); // Two different skin tones
sourceimpl<T> With<Gender, T>
impl<T> With<Gender, T>
sourceimpl<T> With<Hair, T>
impl<T> With<Hair, T>
sourceimpl<T> With<Pair, T>
impl<T> With<Pair, T>
sourceimpl<T> With<Family, T>
impl<T> With<Family, T>
Customizing by Family
.
Notice that various type that implement Into<Family>
such as (Gender,Gender)
,
and (Pair,Pair)
.
Examples
assert_eq!(FAMILY.to_string(), "👪"); // default, derefs directly to `Emoji`
assert_eq!(FAMILY.gender((Gender::Male, Gender::Female)).to_string(), "👨👧"); // Variant two single genders
assert_eq!(FAMILY.gender((Pair::Males, Pair::Females)).to_string(), "👨👨👧👧"); // Variant with two gender pairs
assert_eq!(FAMILY.gender(Gender::Female.with_children(Pair::Mixed)).to_string(), "👩👧👦"); // Variant based on composer chain
Trait Implementations
sourceimpl<M: PartialEq, T: PartialEq + 'static> PartialEq<With<M, T>> for With<M, T>
impl<M: PartialEq, T: PartialEq + 'static> PartialEq<With<M, T>> for With<M, T>
impl<M: Copy, T: Copy + 'static> Copy for With<M, T>
impl<M: Eq, T: Eq + 'static> Eq for With<M, T>
impl<M, T: 'static> StructuralEq for With<M, T>
impl<M, T: 'static> StructuralPartialEq for With<M, T>
Auto Trait Implementations
impl<M, T> RefUnwindSafe for With<M, T>where
M: RefUnwindSafe,
T: RefUnwindSafe,
impl<M, T> Send for With<M, T>where
M: Send,
T: Send + Sync,
impl<M, T> Sync for With<M, T>where
M: Sync,
T: Sync,
impl<M, T> Unpin for With<M, T>where
M: Unpin,
T: Unpin,
impl<M, T> UnwindSafe for With<M, T>where
M: UnwindSafe,
T: UnwindSafe + RefUnwindSafe,
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