Macro gapbuf::gap_buffer [−][src]
macro_rules! gap_buffer { ($elem:expr; $n:expr) => { ... }; ($($x:expr),*) => { ... }; ($($x:expr,)*) => { ... }; }
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
GapBuffer
containing a given list of elements:
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
GapBuffer
from a given element and size:
let b = gap_buffer!["abc"; 2]; assert_eq!(b.len(), 2); assert_eq!(b[0], "abc"); assert_eq!(b[1], "abc");