pub struct I8<const VAL: i8>;Expand description
Marker type for passing const VAL: i8 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::I8;
assert_eq!(serde_json::from_str::<I8<1>>("1").unwrap(), I8::<1>);
// trying to deserialize `I8<1>` from any value other than `1` produces an error
assert!(serde_json::from_str::<I8<1>>("0").is_err());
assert_eq!(serde_json::to_string(&I8::<1>).unwrap(), "1");
assert_eq!(serde_json::to_string(&I8::<92>).unwrap(), "92");
Implementations§
Source§impl<const VAL: i8> I8<VAL>
impl<const VAL: i8> I8<VAL>
Trait Implementations§
Source§impl<const VAL: i8> ConstMarker for I8<VAL>
impl<const VAL: i8> ConstMarker for I8<VAL>
Source§impl<const VAL: i8> Ord for I8<VAL>
impl<const VAL: i8> Ord for I8<VAL>
Source§impl<const L: i8, const R: i8> PartialOrd<I8<R>> for I8<L>
impl<const L: i8, const R: i8> PartialOrd<I8<R>> for I8<L>
impl<const VAL: i8> Copy for I8<VAL>
impl<const VAL: i8> Eq for I8<VAL>
Auto Trait Implementations§
impl<const VAL: i8> Freeze for I8<VAL>
impl<const VAL: i8> RefUnwindSafe for I8<VAL>
impl<const VAL: i8> Send for I8<VAL>
impl<const VAL: i8> Sync for I8<VAL>
impl<const VAL: i8> Unpin for I8<VAL>
impl<const VAL: i8> UnsafeUnpin for I8<VAL>
impl<const VAL: i8> UnwindSafe for I8<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