pub struct ListObj {
pub header: Header,
/* private fields */
}Expand description
A list: header, length and a pointer to a backing array.
Reads never lock, even on shared lists. The length and buffer pointer are atomic words, and a reader bounds-checks against the buffer it loaded, so it sees some consistent-enough state and never reads out of bounds. A writer (the owner, or a thread holding a shared list’s lock) that outgrows the buffer copies it into a new one and swaps the pointer; the old buffer is retired to the collector, which frees it only once the world is stopped and no reader can hold it.
Fields§
§header: HeaderImplementations§
Source§impl ListObj
impl ListObj
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn get(&self, i: usize) -> Option<Value>
pub fn get(&self, i: usize) -> Option<Value>
The item at i, if in bounds. Safe against concurrent writers; the caller must still have
passed the ownership read check.
Sourcepub fn get_local(&self, i: usize) -> Option<Value>
pub fn get_local(&self, i: usize) -> Option<Value>
As ListObj::get for a list owned by this thread or frozen, where nothing races.
pub fn capacity(&self) -> usize
Auto Trait Implementations§
impl !Freeze for ListObj
impl RefUnwindSafe for ListObj
impl Send for ListObj
impl Sync for ListObj
impl Unpin for ListObj
impl UnsafeUnpin for ListObj
impl UnwindSafe for ListObj
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