mirror of
https://github.com/OMGeeky/confique.git
synced 2026-02-23 15:38:30 +01:00
Implement Display for meta::Integer and meta::Float
Those impls is pretty unambiguous I think.
This commit is contained in:
31
src/meta.rs
31
src/meta.rs
@@ -1,6 +1,8 @@
|
||||
//! Types for [`Config::META`][super::Config::META]. Represent information about
|
||||
//! a configuration type.
|
||||
|
||||
use core::fmt;
|
||||
|
||||
// TODO: having all these fields public make me uncomfortable. For now it's
|
||||
// fine, but before reaching 1.0 I need to figure out how to allow future
|
||||
// additions without breaking stuff.
|
||||
@@ -63,3 +65,32 @@ pub enum Integer {
|
||||
I128(i128),
|
||||
Isize(isize),
|
||||
}
|
||||
|
||||
|
||||
impl fmt::Display for Float {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::F32(v) => v.fmt(f),
|
||||
Self::F64(v) => v.fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Integer {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::U8(i) => i.fmt(f),
|
||||
Self::U16(i) => i.fmt(f),
|
||||
Self::U32(i) => i.fmt(f),
|
||||
Self::U64(i) => i.fmt(f),
|
||||
Self::U128(i) => i.fmt(f),
|
||||
Self::Usize(i) => i.fmt(f),
|
||||
Self::I8(i) => i.fmt(f),
|
||||
Self::I16(i) => i.fmt(f),
|
||||
Self::I32(i) => i.fmt(f),
|
||||
Self::I64(i) => i.fmt(f),
|
||||
Self::I128(i) => i.fmt(f),
|
||||
Self::Isize(i) => i.fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user