Struct RoDatabaseUnique

Source
pub struct RoDatabaseUnique<KC, DC, Tag = (), C = DefaultComparator> { /* private fields */ }
Expand description

Read-only wrapper for heed::Database.

The type tag can be used to distinguish between different database envs. Databases and txns opened within an Env will also be tagged, ensuring that txns created in an Env can only be used for DBs created/opened by the same Env.

Implementations§

Source§

impl<KC, DC, Tag, C> RoDatabaseUnique<KC, DC, Tag, C>

Source

pub fn contains_key<'a, 'txn>( &self, rotxn: &'txn RoTxn<'_, Tag>, key: &'a KC::EItem, ) -> Result<bool, TryGet>
where KC: BytesEncode<'a>, LazyDecode<DC>: BytesDecode<'txn>,

Check if the provided key exists in the db. The stored value is not decoded, if it exists.

Source

pub fn first<'txn>( &self, rotxn: &'txn RoTxn<'_, Tag>, ) -> Result<Option<(KC::DItem, DC::DItem)>, First>
where KC: BytesDecode<'txn>, DC: BytesDecode<'txn>,

Source

pub fn iter<'a, 'txn>( &'a self, rotxn: &'txn RoTxn<'a, Tag>, ) -> Result<impl FallibleIterator<Item = (KC::DItem, DC::DItem), Error = IterItem> + 'txn, IterInit>
where KC: BytesDecode<'txn>, DC: BytesDecode<'txn>,

Source

pub fn iter_keys<'a, 'txn>( &'a self, rotxn: &'txn RoTxn<'a, Tag>, ) -> Result<impl FallibleIterator<Item = KC::DItem, Error = IterItem> + 'txn, IterInit>
where KC: BytesDecode<'txn>, LazyDecode<DC>: BytesDecode<'txn>,

Source

pub fn last<'txn>( &self, rotxn: &'txn RoTxn<'_, Tag>, ) -> Result<Option<(KC::DItem, DC::DItem)>, Last>
where KC: BytesDecode<'txn>, DC: BytesDecode<'txn>,

Source

pub fn lazy_decode(&self) -> RoDatabaseUnique<KC, LazyDecode<DC>, Tag, C>

Source

pub fn len(&self, rotxn: &RoTxn<'_, Tag>) -> Result<u64, Len>

Source

pub fn name(&self) -> &str

Source

pub fn range<'a, 'range, 'txn, R>( &'a self, rotxn: &'txn RoTxn<'a, Tag>, range: &'range R, ) -> Result<impl FallibleIterator<Item = (KC::DItem, DC::DItem), Error = IterItem> + 'txn, RangeInit>
where KC: BytesDecode<'txn> + BytesEncode<'range>, DC: BytesDecode<'txn>, R: RangeBounds<KC::EItem>, C: Comparator,

Source

pub fn rev_iter<'a, 'txn>( &'a self, rotxn: &'txn RoTxn<'a, Tag>, ) -> Result<impl FallibleIterator<Item = (KC::DItem, DC::DItem), Error = IterItem> + 'txn, IterInit>
where KC: BytesDecode<'txn>, DC: BytesDecode<'txn>,

Source

pub fn try_get<'a, 'txn>( &self, rotxn: &'txn RoTxn<'_, Tag>, key: &'a KC::EItem, ) -> Result<Option<DC::DItem>, TryGet>
where KC: BytesEncode<'a>, DC: BytesDecode<'txn>,

Source

pub fn get<'a, 'txn>( &self, rotxn: &'txn RoTxn<'_, Tag>, key: &'a KC::EItem, ) -> Result<DC::DItem, Get>
where KC: BytesEncode<'a>, DC: BytesDecode<'txn>,

Source

pub fn watch(&self) -> &Receiver<()>

Available on crate feature observe only.

Receive notifications when the DB is updated

Trait Implementations§

Source§

impl<KC, DC, Tag, C> Clone for RoDatabaseUnique<KC, DC, Tag, C>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
Source§

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

Performs copy-assignment from source. Read more
Source§

impl<KC, DC, Tag, C> Database for RoDatabaseUnique<KC, DC, Tag, C>

Source§

type KC = KC

Source§

type DC = DC

Source§

fn name(&self) -> &str

Source§

impl<KC, DC, Tag, C> Debug for RoDatabaseUnique<KC, DC, Tag, C>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<KC, DC, Tag, C> Freeze for RoDatabaseUnique<KC, DC, Tag, C>

§

impl<KC, DC, Tag, C> RefUnwindSafe for RoDatabaseUnique<KC, DC, Tag, C>

§

impl<KC, DC, Tag, C> Send for RoDatabaseUnique<KC, DC, Tag, C>
where Tag: Send, KC: Send, DC: Send, C: Send,

§

impl<KC, DC, Tag, C> Sync for RoDatabaseUnique<KC, DC, Tag, C>
where Tag: Sync, KC: Sync, DC: Sync, C: Sync,

§

impl<KC, DC, Tag, C> Unpin for RoDatabaseUnique<KC, DC, Tag, C>
where Tag: Unpin, KC: Unpin, DC: Unpin, C: Unpin,

§

impl<KC, DC, Tag, C> UnwindSafe for RoDatabaseUnique<KC, DC, Tag, C>
where Tag: UnwindSafe, KC: UnwindSafe, DC: UnwindSafe, C: 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> 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> 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.