Macro abi_stable::rslice

source ·
macro_rules! rslice {
    ( $( $elem:expr ),* $(,)* ) => { ... };
}
Expand description

A macro to construct RSlices.

When this macro doesn’t work(due to lifetime issues), you’ll have to separately create a slice, then pass it to the RSlice::from_slice const function.

§Examples

use abi_stable::{
    std_types::RSlice,
    rslice,
};


const EMPTY: RSlice<'_, u8> = rslice![];
// `RSlice<'_, T>`s can be compared with `&[T]`s
assert_eq!(EMPTY, <&[u8]>::default());

const FOO: RSlice<'_,u8> = rslice![1, 2, 3, 5, 8, 13];
assert_eq!(FOO[..], [1, 2, 3, 5, 8, 13]);