pub trait IterBytes { fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool; }
A trait to implement in order to make a type hashable;
This works in combination with the trait std::hash::Hash
, and
may in the future be merged with that trait or otherwise
modified when default methods and trait inheritance are
completed.
IterBytes should be implemented so that the extent of the produced byte stream can be discovered, given the original type. For example, the IterBytes implementation for vectors emits its length first, and enums should emit their discriminant.
fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool
Call the provided callback f
one or more times with
byte-slices that should be used when computing a hash
value or otherwise "flattening" the structure into
a sequence of bytes. The lsb0
parameter conveys
whether the caller is asking for little-endian bytes
(true
) or big-endian (false
); this should only be
relevant in implementations that represent a single
multi-byte datum such as a 32 bit integer or 64 bit
floating-point value. It can be safely ignored for
larger structured types as they are usually processed
left-to-right in declaration order, regardless of
underlying memory endianness.
KillHandle
PluralKeyword
Either<L, R>
Option<A>
SendStr
Ascii
impl IterBytes for bool
impl IterBytes for u8
impl IterBytes for u16
impl IterBytes for u32
impl IterBytes for u64
impl IterBytes for i8
impl IterBytes for i16
impl IterBytes for i32
impl IterBytes for i64
impl IterBytes for char
impl IterBytes for uint
impl IterBytes for int
impl IterBytes for float
impl IterBytes for f32
impl IterBytes for f64
impl<'self, A: IterBytes> IterBytes for &'self [A]
impl<A: IterBytes> IterBytes for (A)
impl<A: IterBytes, B: IterBytes> IterBytes for (A, B)
impl<A: IterBytes, B: IterBytes, C: IterBytes> IterBytes for (A, B, C)
impl<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes> IterBytes for (A, B, C, D)
impl<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes, E: IterBytes> IterBytes for (A, B, C, D, E)
impl<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes, E: IterBytes, F: IterBytes> IterBytes for (A, B, C, D, E, F)
impl<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes, E: IterBytes, F: IterBytes, G: IterBytes> IterBytes for (A, B, C, D, E, F, G)
impl<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes, E: IterBytes, F: IterBytes, G: IterBytes, H: IterBytes> IterBytes for (A, B, C, D, E, F, G, H)
impl<A: IterBytes> IterBytes for ~[A]
impl<A: IterBytes> IterBytes for @[A]
impl<'self> IterBytes for &'self str
impl IterBytes for ~str
impl IterBytes for @str
impl<'self, A: IterBytes> IterBytes for &'self A
impl<A: IterBytes> IterBytes for @A
impl<A: IterBytes> IterBytes for @mut A
impl<A: IterBytes> IterBytes for ~A
impl<A> IterBytes for *A
impl<A> IterBytes for *mut A
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).