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
impl AsReadonly for OwnedReadonlyFork
Source§type Readonly = OwnedReadonlyFork
type Readonly = OwnedReadonlyFork
Readonly version of the access.
Source§fn as_readonly(&self) -> Self::Readonly
fn as_readonly(&self) -> Self::Readonly
Performs the conversion.
Source§impl Clone for OwnedReadonlyFork
impl Clone for OwnedReadonlyFork
Source§fn clone(&self) -> OwnedReadonlyFork
fn clone(&self) -> OwnedReadonlyFork
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for OwnedReadonlyFork
impl Debug for OwnedReadonlyFork
Source§impl From<OwnedReadonlyFork> for GenericRawAccess<'_>
impl From<OwnedReadonlyFork> for GenericRawAccess<'_>
Source§fn from(ro_fork: OwnedReadonlyFork) -> Self
fn from(ro_fork: OwnedReadonlyFork) -> Self
Converts to this type from the input type.
Source§impl RawAccess for OwnedReadonlyFork
impl RawAccess for OwnedReadonlyFork
Source§type Changes = ChangesRef<'static>
type Changes = ChangesRef<'static>
Type of the
changes()
that will be applied to the database.Source§fn snapshot(&self) -> &dyn Snapshot
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
fn changes(&self, address: &ResolvedAddress) -> Self::Changes
Returns changes related to specific
address
compared to the snapshot()
.Auto Trait Implementations§
impl Freeze for OwnedReadonlyFork
impl !RefUnwindSafe for OwnedReadonlyFork
impl !Send for OwnedReadonlyFork
impl !Sync for OwnedReadonlyFork
impl Unpin for OwnedReadonlyFork
impl !UnwindSafe for OwnedReadonlyFork
Blanket Implementations§
Source§impl<T> Access for Twhere
T: RawAccess,
impl<T> Access for Twhere
T: RawAccess,
Source§fn get_index_metadata(
self,
addr: IndexAddress,
) -> Result<Option<IndexMetadata>, AccessError>
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>
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>
fn group_keys<K>( self, base_addr: IndexAddress, ) -> GroupKeys<<T as Access>::Base, K>
Returns an iterator over keys in a group with the specified address. Read more
Source§impl<T> AccessExt for Twhere
T: Access,
impl<T> AccessExt for Twhere
T: Access,
Source§fn get_group<K, I>(&self, name: impl Into<String>) -> Group<Self, K, I>
fn get_group<K, I>(&self, name: impl Into<String>) -> Group<Self, K, I>
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>
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>
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>
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>
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>
fn get_key_set<I, K>(&self, addr: I) -> KeySetIndex<Self::Base, K>
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>,
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> 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