Module ocl_core::util [] [src]

Utility and debugging functions.

Stability

Printing functions may be moved/renamed/removed at any time.

Modules

colors

ASCII Color Palette

Functions

bytes_into

Converts a vector of bytes into a value of arbitrary type.

bytes_into_string

Converts a byte Vec into a string, removing the trailing null byte if it exists.

bytes_into_trimmed_string

Converts a byte Vec into a string, removing the trailing null byte if it exists, then removes leading and trailing whitespace.

bytes_into_vec

Converts a vector of bytes into a vector of arbitrary type.

bytes_to

Copies a slice of bytes to a new value of arbitrary type.

bytes_to_u32

Copies a byte slice to a new u32.

bytes_to_vec

Copies a slice of bytes into a vector of arbitrary type.

into_bytes

[UNTESTED] Copies an arbitrary primitive or struct into core bytes.

padded_len

Pads len to make it evenly divisible by incr.

print_bytes_as_hex

Does what is says it's gonna.

print_simple
print_slice

[UNSTABLE]: MAY BE REMOVED AT ANY TIME Prints a vector to stdout. Used for debugging.

print_val_range
scrambled_vec

Returns a vector with length size containing random values in the (half-open) range [vals.0, vals.1).

shuffle

Shuffles the values in a vector using a single pass of Fisher-Yates with a weak (not cryptographically secure) random number generator.

shuffled_vec

Returns a vector with length size which is first filled with each integer value in the (inclusive) range [vals.0, vals.1]. If size is greater than the number of integers in the aforementioned range, the integers will repeat. After being filled with size values, the vector is shuffled and the order of its values is randomized.

vec_remove_rebuild

Batch removes elements from a vector using a list of indices to remove.

wrap_vals

Wraps (%) each value in the list vals if it equals or exceeds val_n.