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 Derefs to T, and implements Display if T does.

Fields

default: T

Implementations

Customizing by Tone.

Examples

assert_eq!(RAISING_HANDS.to_string(), "🙌"); // default, derefs directly to `Emoji`
assert_eq!(RAISING_HANDS.tone(Tone::Medium).to_string(), "🙌🏽"); // Toned variant

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

Customizing by Gender.

Examples

assert_eq!(ELF.to_string(), "🧝"); // default, derefs directly to `Emoji`
assert_eq!(ELF.gender(Gender::Female).to_string(), "🧝‍♀️"); // Variant with gender

Customizing by Hair.

Examples

assert_eq!(PERSON.to_string(), "🧑"); // default, derefs directly to `Emoji`
assert_eq!(PERSON.hair(Hair::Red).to_string(), "🧑‍🦰"); // Variant with hair style

Customizing by (gender) Pair.

Examples

assert_eq!(PERSON_HOLDING_HANDS.to_string(), "🧑‍🤝‍🧑"); // default, derefs directly to `Emoji`
assert_eq!(PERSON_HOLDING_HANDS.gender(Pair::Mixed).to_string(), "👫"); // With defined gender

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.