Struct assembly_fdb::ro::BaseHandle

source ·
pub struct BaseHandle<P: Deref, T>
where <P as Deref>::Target: AsRef<[u8]>,
{ /* private fields */ }
Expand description

Base type for a handle to an in-memory data structure

This is basic layout of a handle to an in-memory FDB database. Internally, there is a pointer (&[u8]/Box<[u8]>/Rc<[u8]>/Arc<Mmap>/…) the memory slice as well as a value that represents the current target.

Implementations§

source§

impl<P: Deref, T> BaseHandle<P, T>
where P::Target: AsRef<[u8]>,

source

pub fn map_into<M, O, E>(self, map: M) -> BaseResult<P, O>
where M: Fn(&[u8], T) -> Result<O, E>, E: Into<BaseErrorKind>,

Get the tables

source§

impl<P: Deref> BaseHandle<P, ()>
where P::Target: AsRef<[u8]>,

source

pub fn into_tables(self) -> BaseResult<P, FDBHeader>

Get the tables

source§

impl<P: Deref> BaseHandle<P, FDBHeader>
where P::Target: AsRef<[u8]>,

source

pub fn into_table_at( self, index: usize ) -> BaseResult<P, Option<FDBTableHeader>>

Get the tables

source

pub fn into_table_by_name( self, name: &Latin1Str ) -> BaseResult<P, Option<FDBTableHeader>>

Get the tables

source§

impl<P: Deref> BaseHandle<P, FDBTableHeader>
where P::Target: AsRef<[u8]>,

source

pub fn into_definition(self) -> BaseResult<P, FDBTableDefHeader>

Get the tables

source

pub fn into_data(self) -> BaseResult<P, FDBTableDataHeader>

Get the tables

source§

impl<P: Deref> BaseHandle<P, FDBTableDataHeader>
where P::Target: AsRef<[u8]>,

source

pub fn get_bucket_for_hash(self, id: u32) -> BaseResult<P, FDBBucketHeader>

Get the bucket for a particular id / hash

source§

impl<'a> BaseHandle<&'a [u8], ()>

source

pub fn new_ref(mem: &'a [u8]) -> Self

Create a new database handle

source

pub fn tables(&self) -> Result<'a, FDBHeader>

Get the header for the local database

source§

impl<'a> BaseHandle<&'a [u8], FDBHeader>

source

pub fn table_count(&self) -> u32

Get the number of tables

source

pub fn table_header_list(&self) -> Result<'a, FDBTableHeaderSlice<'a>>

Get the table header slice

source§

impl<'a> BaseHandle<&'a [u8], FDBTableHeader>

source

pub fn table_def_header(&self) -> Result<'a, FDBTableDefHeader>

Get the table definition header

source

pub fn table_data_header(&self) -> Result<'a, FDBTableDataHeader>

Get the table data header

source§

impl<'a> BaseHandle<&'a [u8], FDBTableDefHeader>

source

pub fn column_count(&self) -> u32

Get the number of columns

source

pub fn table_name(&self) -> Result<'a, &'a Latin1Str>

Get the name of the table

source

pub fn column_header_list(&self) -> Result<'a, FDBColumnHeaderSlice<'a>>

Get the column header list

source§

impl<'a> BaseHandle<&'a [u8], FDBColumnHeader>

source

pub fn column_name(&self) -> Result<'a, &'a Latin1Str>

Get the name of the column

source

pub fn column_data_type(&self) -> StdResult<ValueType, UnknownValueType>

Get the type of the column

source§

impl<'a> BaseHandle<&'a [u8], FDBTableDataHeader>

source

pub fn bucket_count(&self) -> u32

Get the number of buckets

source

pub fn bucket_header_list(&self) -> Result<'a, FDBBucketHeaderSlice<'a>>

Get the slice of buckets

source§

impl<'a> BaseHandle<&'a [u8], FDBBucketHeader>

source

pub fn first(&self) -> Option<Result<'a, FDBRowHeaderListEntry>>

Get the first row header entry or None

source

pub fn row_header_iter(&self) -> Handle<'a, FDBRowHeaderRef>

Get an iterator over all buckets

source§

impl<'a> BaseHandle<&'a [u8], FDBRowHeaderListEntry>

source

pub fn next(&self) -> Option<Result<'a, FDBRowHeaderListEntry>>

Get the next row header list entry instance

source

pub fn row_header(&self) -> Result<'a, FDBRowHeader>

Get the associated row header.

source§

impl<'a> BaseHandle<&'a [u8], FDBRowHeader>

source

pub fn field_count(&self) -> u32

Get the number of fields

source

pub fn field_data_list(&self) -> Result<'a, FDBFieldDataSlice<'a>>

Get the slice of fields

source§

impl<'a> BaseHandle<&'a [u8], FDBFieldData>

source

pub fn try_get_value(&self) -> Result<'a, FDBFieldValue>

Get the value from this handle

source§

impl<B: AsRef<[u8]>> BaseHandle<Arc<B>, ()>

source

pub fn new_arc(inner: B) -> Self

Create a new atomically-reference counted handle

source§

impl<B: AsRef<[u8]>, T: Copy> BaseHandle<Arc<B>, T>

source

pub fn as_bytes_handle(&self) -> Handle<'_, T>

Borrow the atomically-reference counted handle as a byte handle

You can use this function to make cloning cheaper

source§

impl<P: Deref> BaseHandle<P, ()>
where <P as Deref>::Target: AsRef<[u8]>,

source

pub fn new(mem: P) -> Self

Creates a new handle

source§

impl<T, P: Deref> BaseHandle<P, Option<T>>
where <P as Deref>::Target: AsRef<[u8]>,

source

pub fn transpose(self) -> Option<BaseHandle<P, T>>

Turns a handle of an option into an option of a handle

source§

impl<P: Deref, T> BaseHandle<P, T>
where <P as Deref>::Target: AsRef<[u8]>,

source

pub fn raw(&self) -> &T

Get a reference to the raw value inside

source

pub fn raw_mut(&mut self) -> &mut T

Get a reference to the raw value inside

source

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

Get the byte slice for the whole database

source

pub fn replace<O>(self, raw: O) -> BaseHandle<P, O>

Replace the value that is stored with the memory pointer

source§

impl<'a, T> BaseHandle<&'a [u8], T>

source

pub fn buf(self) -> &'a [u8]

Returns a copy of the contained buffer

source

pub fn into_raw(self) -> T

Get the raw value out of the handle

source

pub fn map<X>(self, mapper: impl Fn(&'a [u8], T) -> X) -> Handle<'a, X>

Map something with a closure

source

pub fn map_val<X>(self, mapper: impl Fn(T) -> X) -> Handle<'a, X>

Map the value with a closure

source

pub fn try_map<X, E>( self, mapper: impl Fn(&'a [u8], T) -> Result<X, E> ) -> Result<Handle<'a, X>, E>

Map something with a closure

source§

impl<'a, T> BaseHandle<&'a [u8], &'a [T]>

source

pub fn get(self, index: usize) -> Option<RefHandle<'a, T>>

Get the reference at index

source§

impl<'a, T: Repr> BaseHandle<&'a [u8], &'a T>

source

pub fn map_extract(self) -> Handle<'a, T::Value>

Extract a value from a reference

Trait Implementations§

source§

impl<P: Clone + Deref, T: Clone> Clone for BaseHandle<P, T>
where <P as Deref>::Target: AsRef<[u8]>,

source§

fn clone(&self) -> BaseHandle<P, T>

Returns a copy 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<P: Debug + Deref, T: Debug> Debug for BaseHandle<P, T>
where <P as Deref>::Target: AsRef<[u8]>,

source§

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

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

impl<P, T> Copy for BaseHandle<P, T>
where P: Deref + Copy, T: Copy, <P as Deref>::Target: AsRef<[u8]>,

Auto Trait Implementations§

§

impl<P, T> Freeze for BaseHandle<P, T>
where P: Freeze, T: Freeze,

§

impl<P, T> RefUnwindSafe for BaseHandle<P, T>

§

impl<P, T> Send for BaseHandle<P, T>
where P: Send, T: Send,

§

impl<P, T> Sync for BaseHandle<P, T>
where P: Sync, T: Sync,

§

impl<P, T> Unpin for BaseHandle<P, T>
where P: Unpin, T: Unpin,

§

impl<P, T> UnwindSafe for BaseHandle<P, T>
where P: UnwindSafe, T: UnwindSafe,

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<I> IntoIterator for I
where I: Iterator,

§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of iterator are we turning this into?
const: unstable · source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
source§

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

§

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>,

§

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>,

§

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.