(bytes: &mut R)
| 50 | #[cfg(feature = "std")] |
| 51 | #[inline] |
| 52 | fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error> { |
| 53 | let mut some_or_none = [0u8; 1]; |
| 54 | bytes.read_exact(&mut some_or_none)?; |
| 55 | match some_or_none[0] { |
| 56 | 0 => { |
| 57 | Ok(None) |
| 58 | }, |
| 59 | 1 => { |
| 60 | let element = T::tls_deserialize(bytes)?; |
| 61 | Ok(Some(element)) |
| 62 | }, |
| 63 | _ => Err(Error::DecodingError(format!("Trying to decode Option<T> with {} for option. It must be 0 for None and 1 for Some.", some_or_none[0]))) |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | macro_rules! impl_unsigned { |
nothing calls this directly
no test coverage detected