The ToBytes and IterBytes traits

Type Cb

type Cb = &fn(buf: &[const u8]) -> bool

Interface IterBytes

A trait to implement in order to make a type hashable; This works in combination with the trait Hash::Hash, and may in the future be merged with that trait or otherwise modified when default methods and trait inheritence are completed.

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

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.

Interface ToBytes

Method to_bytes

fn to_bytes(lsb0: bool) -> ~[u8]

Implementation of IterBytes for bool

Method iter_bytes

fn iter_bytes(_lsb0: bool, f: Cb)

Implementation of IterBytes for u8

Method iter_bytes

fn iter_bytes(_lsb0: bool, f: Cb)

Implementation of IterBytes for u16

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for u32

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for u64

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for i8

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for i16

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for i32

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for i64

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for char

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for int

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for &[A]

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for (A, B)

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for (A, B, C)

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for ~[A]

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for @[A]

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for &str

Method iter_bytes

fn iter_bytes(_lsb0: bool, f: Cb)

Implementation of IterBytes for ~str

Method iter_bytes

fn iter_bytes(_lsb0: bool, f: Cb)

Implementation of IterBytes for @str

Method iter_bytes

fn iter_bytes(_lsb0: bool, f: Cb)

Implementation of IterBytes for Option<A>

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for &A

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for @A

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for ~A

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of IterBytes for *const A

Method iter_bytes

fn iter_bytes(lsb0: bool, f: Cb)

Implementation of ToBytes for A

Method to_bytes

fn to_bytes(lsb0: bool) -> ~[u8]

Function borrow

fn borrow<A>(a: &x/[A]) -> &x/[A]

Function iter_bytes_2

fn iter_bytes_2<A: IterBytes, B: IterBytes>(a: &A, b: &B, lsb0: bool, z: Cb)

Function iter_bytes_3

fn iter_bytes_3<A: IterBytes, B: IterBytes,
                C: IterBytes>(a: &A, b: &B, c: &C, lsb0: bool, z: Cb)

Function iter_bytes_4

fn iter_bytes_4<A: IterBytes, B: IterBytes, C: IterBytes,
                D: IterBytes>(a: &A, b: &B, c: &C, d: &D, lsb0: bool, z: Cb)

Function iter_bytes_5

fn iter_bytes_5<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes,
                E: IterBytes>(a: &A, b: &B, c: &C, d: &D, e: &E, lsb0: bool,
                              z: Cb)

Function iter_bytes_6

fn iter_bytes_6<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes,
                E: IterBytes,
                F: IterBytes>(a: &A, b: &B, c: &C, d: &D, e: &E, f: &F,
                              lsb0: bool, z: Cb)

Function iter_bytes_7

fn iter_bytes_7<A: IterBytes, B: IterBytes, C: IterBytes, D: IterBytes,
                E: IterBytes, F: IterBytes,
                G: IterBytes>(a: &A, b: &B, c: &C, d: &D, e: &E, f: &F, g: &G,
                              lsb0: bool, z: Cb)