le_stream/to_le_stream.rs
1mod alloc;
2mod bytes;
3mod core;
4mod heapless;
5mod intx;
6mod macaddr;
7
8/// Converts a value into a stream of little-endian bytes.
9///
10/// The returned iterator yields the complete byte representation of `self`.
11/// Primitive numeric implementations use their standard little-endian byte
12/// order; compound implementations concatenate the byte stream of each field or
13/// element in declaration order.
14pub trait ToLeStream
15where
16 Self::Iter: Iterator<Item = u8>,
17{
18 /// Iterator returned by [`to_le_stream`](Self::to_le_stream).
19 type Iter;
20
21 /// Returns an iterator over the little-endian byte representation.
22 ///
23 /// # Examples
24 ///
25 /// ```
26 /// use le_stream::ToLeStream;
27 ///
28 /// assert_eq!(0x1234_u16.to_le_stream().collect::<Vec<_>>(), [0x34, 0x12]);
29 /// ```
30 fn to_le_stream(self) -> Self::Iter;
31}