arrutil 0.1.2

Macros for manipulating arrays from slices

Crate arrutil [] [src]

This package contains a number of utility macros, which allow for the easier manipulation of arrays, with functionality such as converting to them from slices. It will gain more methods as time advances.

To get around the restriction of a lack of type level integers in rust, every macro generates a local function (accessible only inside the macro) that handles the unsafe code and manipulation of slices and arrays. This is to ensure that lifetimes behave as expected. Every macro has documentation for it's inner macro function attached to it. The macros themselves have identical syntax to these function with the addition of all sizes for arrays being passed as literals.

If there are any macros you think should be in this crate and are missing, raise an issue on this crates repository and if they belong here I'll add them as soon as possible!

Macros

slice_to_array

You can use slice_to_array to create a reference to an array from a slice.

slice_to_array_mut

You can use slice_to_array_mut to create a reference to an array from a mutable slice.

slice_to_array_mut_unchecked

You can use slice_to_array_mut_unchecked to turn a mutable slice into a mutable reference to an array without bounds checking.

slice_to_array_unchecked

You can use slice_to_array_unchecked to turn a slice into a reference to an array without bounds checking.

split_to_array

You can use split_to_array to turn a slice into a reference to an array and a slice starting from the end of the array.

split_to_array_mut

You can use split_to_array_mut to turn a mutable slice into a mutable reference to an array and a mutable slice starting from the end of the array.

split_to_array_scan

You can use split_to_array_scan to turn a slice into a reference to an array while mutating the original slice.