bin.rs (603B)
1 use super::{ 2 super::super::bin::{Decode, Encode}, 3 UserHandle, 4 }; 5 use core::convert::Infallible; 6 impl<const LEN: usize> Encode for UserHandle<LEN> { 7 type Output<'a> 8 = [u8; LEN] 9 where 10 Self: 'a; 11 type Err = Infallible; 12 #[inline] 13 fn encode(&self) -> Result<Self::Output<'_>, Self::Err> { 14 Ok(self.0) 15 } 16 } 17 impl<const LEN: usize> Decode for UserHandle<LEN> 18 where 19 Self: Default, 20 { 21 type Input<'a> = [u8; LEN]; 22 type Err = Infallible; 23 #[inline] 24 fn decode(input: Self::Input<'_>) -> Result<Self, Self::Err> { 25 Ok(Self(input)) 26 } 27 }