Struct OwnedReadonlyFork

Source
pub struct OwnedReadonlyFork(/* private fields */);
Expand description

Version of ReadonlyFork with a static lifetime. Can be produced from an Rc<Fork> using the AsReadonly trait.

Beware that producing an instance increases the reference counter of the underlying fork. If you need to obtain Fork from Rc<Fork> via Rc::try_unwrap, make sure that all OwnedReadonlyFork instances are dropped by this time.

§Examples

let db = TemporaryDB::new();
let fork = Rc::new(db.fork());
fork.get_list("list").extend(vec![1_u32, 2, 3]);
let ro_fork: OwnedReadonlyFork = fork.as_readonly();
let list = ro_fork.get_list::<_, u32>("list");
assert_eq!(list.len(), 3);

Trait Implementations§

Source§

impl AsReadonly for OwnedReadonlyFork

Source§

type Readonly = OwnedReadonlyFork

Readonly version of the access.
Source§

fn as_readonly(&self) -> Self::Readonly

Performs the conversion.
Source§

impl Clone for OwnedReadonlyFork

Source§

fn clone(&self) -> OwnedReadonlyFork

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 Debug for OwnedReadonlyFork

Source§

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

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

impl From<OwnedReadonlyFork> for GenericRawAccess<'_>

Source§

fn from(ro_fork: OwnedReadonlyFork) -> Self

Converts to this type from the input type.
Source§

impl RawAccess for OwnedReadonlyFork

Source§

type Changes = ChangesRef<'static>

Type of the changes() that will be applied to the database.
Source§

fn snapshot(&self) -> &dyn Snapshot

Reference to a Snapshot. This is the base relative to which the changes are defined.
Source§

fn changes(&self, address: &ResolvedAddress) -> Self::Changes

Returns changes related to specific address compared to the snapshot().

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Access for T
where T: RawAccess,

Source§

type Base = T

Raw access serving as the basis for created indexes.
Source§

fn get_index_metadata( self, addr: IndexAddress, ) -> Result<Option<IndexMetadata>, AccessError>

Gets index metadata at the specified address, or None if there is no index.
Source§

fn get_or_create_view( self, addr: IndexAddress, index_type: IndexType, ) -> Result<ViewWithMetadata<<T as Access>::Base>, AccessError>

Gets or creates a generic view with the specified address.
Source§

fn group_keys<K>( self, base_addr: IndexAddress, ) -> GroupKeys<<T as Access>::Base, K>
where K: BinaryKey + ?Sized, <T as Access>::Base: AsReadonly<Readonly = <T as Access>::Base>,

Returns an iterator over keys in a group with the specified address. Read more
Source§

impl<T> AccessExt for T
where T: Access,

Source§

fn get_group<K, I>(&self, name: impl Into<String>) -> Group<Self, K, I>
where K: BinaryKey + ?Sized, I: FromAccess<Self>,

Returns a group of indexes. All indexes in the group have the same type. Indexes are initialized lazily; i.e., no initialization is performed when the group is created. Read more
Source§

fn get_entry<I, V>(&self, addr: I) -> Entry<Self::Base, V>

Gets an entry index with the specified address. Read more
Source§

fn get_list<I, V>(&self, addr: I) -> ListIndex<Self::Base, V>

Gets a list index with the specified address. Read more
Source§

fn get_map<I, K, V>(&self, addr: I) -> MapIndex<Self::Base, K, V>

Gets a map index with the specified address. Read more
Source§

fn get_sparse_list<I, V>(&self, addr: I) -> SparseListIndex<Self::Base, V>

Gets a sparse list index with the specified address. Read more
Source§

fn get_key_set<I, K>(&self, addr: I) -> KeySetIndex<Self::Base, K>
where I: Into<IndexAddress>, K: BinaryKey + ?Sized,

Gets a key set index with the specified address. Read more
Source§

fn index_type<I>(&self, addr: I) -> Option<IndexType>
where I: Into<IndexAddress>,

Gets index type at the specified address, or None if there is no index.
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, dst: *mut u8)

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.