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