|
|
|
@ -13,7 +13,7 @@ pub trait FormatSpec
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// A strongly validated string slice
|
|
|
|
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
|
|
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
|
|
|
|
|
#[repr(transparent)]
|
|
|
|
|
pub struct FormattedStr<F: FormatSpec + ?Sized>(PhantomData<*const F>, str);
|
|
|
|
|
|
|
|
|
@ -22,7 +22,8 @@ unsafe impl<F: FormatSpec + ?Sized> std::marker::Send for FormattedStr<F>{}
|
|
|
|
|
unsafe impl<F: FormatSpec + ?Sized> std::marker::Sync for FormattedStr<F>{}
|
|
|
|
|
|
|
|
|
|
/// A strongly validated string
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
|
|
|
// TODO: How to perform validation on deserialise?
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
|
|
|
|
pub struct FormattedString<F: FormatSpec + ?Sized>(String, PhantomData<F>);
|
|
|
|
|
|
|
|
|
|
impl<F: FormatSpec + ?Sized> FormattedStr<F>
|
|
|
|
|