macro_rules! gap_buffer {
($elem:expr; $n:expr) => { ... };
($($x:expr),*) => { ... };
($($x:expr,)*) => { ... };
}Expand description
Creates a GapBuffer containing the arguments.
gap_buffer! allows GapBuffer to be defined with the same syntax as vec!.
There are two forms of this macro:
- Create a
GapBuffercontaining a given list of elements:
use gap_buf::gap_buffer;
let b = gap_buffer![1, 2, 3];
assert_eq!(b.len(), 3);
assert_eq!(b[0], 1);
assert_eq!(b[1], 2);
assert_eq!(b[2], 3);- Create a
GapBufferfrom a given element and size:
use gap_buf::gap_buffer;
let b = gap_buffer!["abc"; 2];
assert_eq!(b.len(), 2);
assert_eq!(b[0], "abc");
assert_eq!(b[1], "abc");