pub enum Data<'b, 'tx> {
Bucket(BucketName<'b, 'tx>),
KeyValue(KVPair<'b, 'tx>),
}
Expand description
Key / Value or Bucket Data
The two enum variants represent either a key / value pair or a nested bucket. If you want to access the underneath data, you must match the variant first.
Examples
use jammdb::{DB, Data};
let db = DB::open("my.db")?;
let mut tx = db.tx(true)?;
let bucket = tx.create_bucket("my-bucket")?;
if let Some(data) = bucket.get("my-key") {
match data {
Data::Bucket(b) => assert_eq!(b.name(), b"my-key"),
Data::KeyValue(kv) => assert_eq!(kv.key(), b"my-key"),
}
}
Variants§
Bucket(BucketName<'b, 'tx>)
Contains data about a nested bucket
KeyValue(KVPair<'b, 'tx>)
a key / value pair of bytes
Implementations§
Trait Implementations§
source§impl<'b, 'tx> PartialEq for Data<'b, 'tx>
impl<'b, 'tx> PartialEq for Data<'b, 'tx>
impl<'b, 'tx> Eq for Data<'b, 'tx>
impl<'b, 'tx> StructuralEq for Data<'b, 'tx>
impl<'b, 'tx> StructuralPartialEq for Data<'b, 'tx>
Auto Trait Implementations§
impl<'b, 'tx> RefUnwindSafe for Data<'b, 'tx>
impl<'b, 'tx> !Send for Data<'b, 'tx>
impl<'b, 'tx> !Sync for Data<'b, 'tx>
impl<'b, 'tx> Unpin for Data<'b, 'tx>
impl<'b, 'tx> UnwindSafe for Data<'b, 'tx>
Blanket Implementations§
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