Value

Struct Value 

Source
pub struct Value<E> { /* private fields */ }

Implementations§

Source§

impl<E: Fixed> Value<E>

Source

pub unsafe fn open( mode: OpenMode, file: File, max_margin: u64, ) -> Result<Self, OpenError>

Source

pub fn len(&self) -> u64

Source

pub fn last_id(&self) -> u64

Source

pub fn is_empty(&self) -> bool

Source

pub fn last_entry_id(&self) -> Option<u64>

Source

pub unsafe fn buf_unchecked(&self, id: u64) -> BufConst<E>

Source

pub unsafe fn buf_mut_unchecked(&mut self, id: u64) -> BufMut<E>

Source

pub fn last_buf(&self) -> Option<BufConst<E>>

Source

pub fn is_id_valid(&self, id: u64) -> bool

Source

pub fn buf(&self, id: u64) -> BufConst<E>

Source

pub fn buf_mut(&mut self, id: u64) -> BufMut<E>

Source

pub fn add(&mut self, entry: impl Readable<E>) -> Result<u64, AddError>

Source

pub fn remove_last(&mut self) -> Result<(), RemoveLastError>

Source

pub fn remove_if_last(&mut self, id: u64) -> Result<bool, RemoveLastError>

Source

pub fn all_ids(&self) -> impl Iterator<Item = u64>

Source

pub unsafe fn copy(&mut self, src_id: u64, dst_id: u64)

Source

pub unsafe fn swap(&mut self, a_id: u64, b_id: u64)

Source

pub unsafe fn swap_remove(&mut self, id: u64) -> Result<(), SwapRemoveError>

Swaps given entry with the last entry and removes it. WARNING: This method changes ID of the last entry in this collection. You probably should only use this if this collection is used as a stack/set and not as a map. Doesn’t check if id is valid.

Source

pub fn set(&mut self, id: u64, value: impl Readable<E>)

Source§

impl<E: Decode> Value<E>

Source

pub fn get(&self, id: u64) -> E

Auto Trait Implementations§

§

impl<E> Freeze for Value<E>

§

impl<E> RefUnwindSafe for Value<E>

§

impl<E> Send for Value<E>

§

impl<E> Sync for Value<E>

§

impl<E> Unpin for Value<E>

§

impl<E> UnwindSafe for Value<E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.