Lines Matching full:bytes
38 type Bytes: NumBytes; typedef
47 /// let bytes = ToBytes::to_be_bytes(&0x12345678u32);
48 /// assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]);
50 fn to_be_bytes(&self) -> Self::Bytes; in to_be_bytes() argument
59 /// let bytes = ToBytes::to_le_bytes(&0x12345678u32);
60 /// assert_eq!(bytes, [0x78, 0x56, 0x34, 0x12]);
62 fn to_le_bytes(&self) -> Self::Bytes; in to_le_bytes() argument
83 /// let bytes = ToBytes::to_ne_bytes(&0x12345678u32);
84 /// assert_eq!(bytes, expected)
86 fn to_ne_bytes(&self) -> Self::Bytes { in to_ne_bytes() argument
88 let bytes = self.to_be_bytes(); in to_ne_bytes() localVariable
90 let bytes = self.to_le_bytes(); in to_ne_bytes() localVariable
91 bytes in to_ne_bytes()
96 type Bytes: NumBytes + ?Sized; typedef
108 fn from_be_bytes(bytes: &Self::Bytes) -> Self; in from_be_bytes()
120 fn from_le_bytes(bytes: &Self::Bytes) -> Self; in from_le_bytes()
136 /// let bytes = [0x12, 0x34, 0x56, 0x78];
139 /// let bytes = [0x78, 0x56, 0x34, 0x12];
141 /// let value: u32 = FromBytes::from_ne_bytes(&bytes);
144 fn from_ne_bytes(bytes: &Self::Bytes) -> Self { in from_ne_bytes()
146 let this = Self::from_be_bytes(bytes); in from_ne_bytes()
148 let this = Self::from_le_bytes(bytes); in from_ne_bytes()
157 type Bytes = [u8; $L];
160 fn to_be_bytes(&self) -> Self::Bytes {
165 fn to_le_bytes(&self) -> Self::Bytes {
170 fn to_ne_bytes(&self) -> Self::Bytes {
177 type Bytes = [u8; $L];
180 fn from_be_bytes(bytes: &Self::Bytes) -> Self {
181 <$T>::from_be_bytes(*bytes)
185 fn from_le_bytes(bytes: &Self::Bytes) -> Self {
186 <$T>::from_le_bytes(*bytes)
190 fn from_ne_bytes(bytes: &Self::Bytes) -> Self {
191 <$T>::from_ne_bytes(*bytes)
197 type Bytes = [u8; $L];
200 fn to_be_bytes(&self) -> Self::Bytes {
205 fn to_le_bytes(&self) -> Self::Bytes {
210 fn to_ne_bytes(&self) -> Self::Bytes {
217 type Bytes = [u8; $L];
220 fn from_be_bytes(bytes: &Self::Bytes) -> Self {
221 Self::from_bits(FromBytes::from_be_bytes(bytes))
225 fn from_le_bytes(bytes: &Self::Bytes) -> Self {
226 Self::from_bits(FromBytes::from_le_bytes(bytes))
230 fn from_ne_bytes(bytes: &Self::Bytes) -> Self {
231 Self::from_bits(FromBytes::from_ne_bytes(bytes))
241 type Bytes = [u8; $L];
244 fn to_be_bytes(&self) -> Self::Bytes {
249 fn to_le_bytes(&self) -> Self::Bytes {
254 fn to_ne_bytes(&self) -> Self::Bytes {
261 type Bytes = [u8; $L];
264 fn from_be_bytes(bytes: &Self::Bytes) -> Self {
265 <$T>::from_be_bytes(*bytes)
269 fn from_le_bytes(bytes: &Self::Bytes) -> Self {
270 <$T>::from_le_bytes(*bytes)
274 fn from_ne_bytes(bytes: &Self::Bytes) -> Self {
275 <$T>::from_ne_bytes(*bytes)
281 type Bytes = [u8; $L];
284 fn to_be_bytes(&self) -> Self::Bytes {
289 fn to_le_bytes(&self) -> Self::Bytes {
294 fn to_ne_bytes(&self) -> Self::Bytes {
301 type Bytes = [u8; $L];
304 fn from_be_bytes(bytes: &Self::Bytes) -> Self {
305 Self::from_be(<Self as FromBytes>::from_ne_bytes(bytes))
309 fn from_le_bytes(bytes: &Self::Bytes) -> Self {
310 Self::from_le(<Self as FromBytes>::from_ne_bytes(bytes))
314 fn from_ne_bytes(bytes: &Self::Bytes) -> Self {
315 unsafe { transmute(*bytes) }