pub struct Text {
pub years: ThresholdMap<String>,
pub months: ThresholdMap<String>,
pub weeks: ThresholdMap<String>,
pub days: ThresholdMap<String>,
pub hours: ThresholdMap<String>,
pub minutes: ThresholdMap<String>,
pub seconds: ThresholdMap<String>,
pub joiner: String,
pub final_joiner: Option<String>,
pub spacer: String,
}
Expand description
All the strings that may be used to compose the final output. This owns the String
s, so if it’s performance-sensitive, you will want to reuse an instance of Text
.
Each of the units uses a ThresholdMap<String>
, which allows you to have different text for different counts, like for implementing plurals.
By default, joiner
, final_joiner
and spacer
are ", "
, Some(" and ")
and " "
, respectively (except String
s).
Fields§
§years: ThresholdMap<String>
§months: ThresholdMap<String>
§weeks: ThresholdMap<String>
§days: ThresholdMap<String>
§hours: ThresholdMap<String>
§minutes: ThresholdMap<String>
§seconds: ThresholdMap<String>
§joiner: String
In "14 days[, ]6 hours and 56 minutes"
, the bracketed part.
final_joiner: Option<String>
In "14 days, 6 hours[ and ]56 minutes"
, the bracketed part. If none, it will use the regular joiner.
spacer: String
In "14[ ]days, 6[ ]hours and 56[ ]minutes"
, the bracketed parts.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
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