Skip to main content

cgp_field/types/
symbol.rs

1use core::fmt::Display;
2use core::marker::PhantomData;
3
4pub struct ψ<const LEN: usize, Chars>(pub PhantomData<Chars>);
5
6pub use ψ as Symbol;
7
8use crate::traits::StaticFormat;
9
10impl<const LEN: usize, Chars> Default for Symbol<LEN, Chars> {
11    fn default() -> Self {
12        Self(PhantomData)
13    }
14}
15
16impl<const LEN: usize, Chars> StaticFormat for Symbol<LEN, Chars>
17where
18    Chars: StaticFormat,
19{
20    fn fmt(f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
21        Chars::fmt(f)
22    }
23}
24
25impl<const LEN: usize, Chars> Display for Symbol<LEN, Chars>
26where
27    Self: StaticFormat,
28{
29    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
30        <Self as StaticFormat>::fmt(f)
31    }
32}