pub struct U32<const VAL: u32>;Expand description
Marker type for passing const VAL: u32 as a type parameter.
§Serde compatibility
When the "serde" feature is enabled,
this type is serialized/deserialized as the VAL const parameter.
ⓘ
use typewit::const_marker::U32;
assert_eq!(serde_json::from_str::<U32<1>>("1").unwrap(), U32::<1>);
// trying to deserialize `U32<1>` from any value other than `1` produces an error
assert!(serde_json::from_str::<U32<1>>("0").is_err());
assert_eq!(serde_json::to_string(&U32::<1>).unwrap(), "1");
assert_eq!(serde_json::to_string(&U32::<92>).unwrap(), "92");
Implementations§
Source§impl<const VAL: u32> U32<VAL>
impl<const VAL: u32> U32<VAL>
Trait Implementations§
Source§impl<const VAL: u32> ConstMarker for U32<VAL>
impl<const VAL: u32> ConstMarker for U32<VAL>
Source§impl<const VAL: u32> Ord for U32<VAL>
impl<const VAL: u32> Ord for U32<VAL>
Source§impl<const L: u32, const R: u32> PartialOrd<U32<R>> for U32<L>
impl<const L: u32, const R: u32> PartialOrd<U32<R>> for U32<L>
impl<const VAL: u32> Copy for U32<VAL>
impl<const VAL: u32> Eq for U32<VAL>
Auto Trait Implementations§
impl<const VAL: u32> Freeze for U32<VAL>
impl<const VAL: u32> RefUnwindSafe for U32<VAL>
impl<const VAL: u32> Send for U32<VAL>
impl<const VAL: u32> Sync for U32<VAL>
impl<const VAL: u32> Unpin for U32<VAL>
impl<const VAL: u32> UnsafeUnpin for U32<VAL>
impl<const VAL: u32> UnwindSafe for U32<VAL>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more