Module utils

Source
Expand description

buffer slicing and other utilities

Functionsยง

buffer_as_slice
Takes a &[u8] buffer slice and returns a slice &[T] with a given number of elements of type T
buffer_as_slice_mut
Takes a mutable &[u8] buffer slice and returns a mutable slice &[T] with a given number of elements of type T
struct_as_slice_u8
Takes a reference to a struct of type T and returns a raw &[u8] slice with byte length of the type T
substr
Truncate a string, optionally appending another string or appending "..." if the append string is None
substring
Extract a substring starting at 0 and truncating it to min(length,str.len()).