pub struct YamlValueList { /* private fields */ }Expand description
Stores YAML value records ([u64; 2]) for leaf values. Index 0 is reserved as null.
Implementations§
Source§impl YamlValueList
impl YamlValueList
pub fn new() -> Self
Sourcepub fn push(&mut self, record: [u64; 2]) -> u16
pub fn push(&mut self, record: [u64; 2]) -> u16
Appends a value record and returns its index.
§Examples
use state_engine::common::pool::YamlValueList;
let mut list = YamlValueList::new();
let record = [0xABCD_u64, 0x1234_u64];
let idx = list.push(record);
assert_ne!(idx, 0);
assert_eq!(list.get(idx), Some([0xABCD_u64, 0x1234_u64]));
assert_eq!(list.get(0), Some([0u64, 0u64])); // null slot
assert_eq!(list.get(999), None);Trait Implementations§
Auto Trait Implementations§
impl Freeze for YamlValueList
impl RefUnwindSafe for YamlValueList
impl Send for YamlValueList
impl Sync for YamlValueList
impl Unpin for YamlValueList
impl UnsafeUnpin for YamlValueList
impl UnwindSafe for YamlValueList
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more