VecxRaw

Struct VecxRaw 

Source
pub struct VecxRaw { /* private fields */ }
Expand description

A disk-based, Vec-like data structure for raw byte values.

Implementations§

Source§

impl VecxRaw

Source

pub unsafe fn shadow(&self) -> Self

Creates a “shadow” copy of the VecxRaw instance.

§Safety

This API breaks Rust’s semantic safety guarantees. Use only in a race-free environment.

Source

pub unsafe fn from_bytes(s: impl AsRef<[u8]>) -> Self

Creates a VecxRaw from a byte slice.

§Safety

This function is unsafe and assumes the byte slice is a valid representation.

Source

pub fn as_bytes(&self) -> &[u8]

Returns the byte representation of the VecxRaw.

Source

pub fn new() -> Self

Creates a new, empty VecxRaw.

Source

pub fn get(&self, idx: usize) -> Option<RawValue>

Retrieves a value at a specific index.

Source

pub fn get_mut(&mut self, idx: usize) -> Option<ValueMut<'_, u64>>

Retrieves a mutable reference to a value at a specific index.

Source

pub fn last(&self) -> Option<RawValue>

Retrieves the last value in the vector.

Source

pub fn len(&self) -> usize

Returns the number of values in the vector.

Source

pub fn is_empty(&self) -> bool

Checks if the vector is empty.

Source

pub fn push(&mut self, v: impl AsRef<[u8]>)

Appends a value to the end of the vector.

Source

pub fn insert(&mut self, idx: usize, v: impl AsRef<[u8]>)

Inserts a value at a specific index.

§Panics

Panics if idx is out of bounds.

Source

pub fn pop(&mut self) -> Option<RawValue>

Removes and returns the last value in the vector.

Source

pub fn remove(&mut self, idx: usize) -> RawValue

Removes and returns the value at a specific index.

§Panics

Panics if idx is out of bounds.

Source

pub fn swap_remove(&mut self, idx: usize) -> RawValue

Removes a value at a specific index and returns it, replacing it with the last value.

§Panics

Panics if idx is out of bounds.

Source

pub fn update(&mut self, idx: usize, v: impl AsRef<[u8]>) -> Option<RawValue>

Updates the value at a specific index.

§Panics

Panics if idx is out of bounds.

Source

pub fn iter(&self) -> VecxRawIter<'_>

Returns an iterator over the vector’s values.

Source

pub fn iter_mut(&mut self) -> MapxOrdRawValueIterMut<'_, usize>

Returns a mutable iterator over the vector’s values.

Source

pub fn clear(&mut self)

Clears the vector, removing all values.

Source

pub fn is_the_same_instance(&self, other_hdr: &Self) -> bool

Checks if this VecxRaw instance is the same as another.

Trait Implementations§

Source§

impl Clone for VecxRaw

Source§

fn clone(&self) -> VecxRaw

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VecxRaw

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VecxRaw

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for VecxRaw

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for VecxRaw

Source§

fn eq(&self, other: &VecxRaw) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for VecxRaw

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for VecxRaw

Source§

impl StructuralPartialEq for VecxRaw

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> KeyDe for T

Source§

fn decode_key(bytes: &[u8]) -> Result<T, Box<dyn RucError>>

Decodes a key from a byte slice.
Source§

impl<T> KeyEn for T
where T: Serialize,

Source§

fn try_encode_key(&self) -> Result<Vec<u8>, Box<dyn RucError>>

Tries to encode the key into a byte vector.
Source§

fn encode_key(&self) -> RawBytes

Encodes the key into a byte vector, panicking on failure.
Source§

impl<T> KeyEnDe for T
where T: KeyEn + KeyDe,

Source§

fn try_encode(&self) -> Result<Vec<u8>, Box<dyn RucError>>

Tries to encode the key into a byte vector.
Source§

fn encode(&self) -> Vec<u8>

Encodes the key into a byte vector, panicking on failure.
Source§

fn decode(bytes: &[u8]) -> Result<T, Box<dyn RucError>>

Decodes a key from a byte slice.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ValueDe for T

Source§

fn decode_value(bytes: &[u8]) -> Result<T, Box<dyn RucError>>

Decodes a value from a byte slice.
Source§

impl<T> ValueEn for T
where T: Serialize,

Source§

fn try_encode_value(&self) -> Result<Vec<u8>, Box<dyn RucError>>

Tries to encode the value into a byte vector.
Source§

fn encode_value(&self) -> RawBytes

Encodes the value into a byte vector, panicking on failure.
Source§

impl<T> ValueEnDe for T
where T: ValueEn + ValueDe,

Source§

fn try_encode(&self) -> Result<Vec<u8>, Box<dyn RucError>>

Tries to encode the value into a byte vector.
Source§

fn encode(&self) -> Vec<u8>

Encodes the value into a byte vector, panicking on failure.
Source§

fn decode(bytes: &[u8]) -> Result<T, Box<dyn RucError>>

Decodes a value from a byte slice.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,