struct StyleSet(EnumMap<StyleParams, NumberStyle>);
impl StyleSet {
- fn new(f: impl Fn(StyleParams) -> NumberStyle) -> Self {
- Self(EnumMap::from_fn(f))
+ const fn new(f: impl Fn(StyleParams) -> NumberStyle) -> Self {
+ f(StyleParams {
+ decimal: Decimal::Comma,
+ leading_zero: false,
+ });
+ todo!()
+ //Self(EnumMap::from_fn(f))
}
- const fn get(&self, settings: &Settings) -> &NumberStyle {
+ fn get(&self, settings: &Settings) -> &NumberStyle {
&self.0[settings.into()]
}
}
let prefix = Affix::new_static(prefix);
let suffix = Affix::new_static(suffix);
let neg_suffix = Affix::new_static("");
- let extra_bytes = neg_prefix.extra_bytes()
- + prefix.extra_bytes()
- + suffix.extra_bytes()
- + neg_suffix.extra_bytes();
Self {
neg_prefix,
decimal,
grouping,
leading_zero,
- extra_bytes,
+ extra_bytes: 0,
}
}
}
}
- fn new(s: String) -> Self {
+ pub fn new(s: String) -> Self {
Self {
width: s.width(),
s: Cow::from(s),
}
}
- const fn extra_bytes(&self) -> usize {
+ pub fn extra_bytes(&self) -> usize {
self.s.len().checked_sub(self.width).unwrap()
}
}