diff --git a/src/meta.rs b/src/meta.rs index 6326918..ab78207 100644 --- a/src/meta.rs +++ b/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), + } + } +}