Enum jammdb::Data [−][src]
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(BucketData)
Contains data about a nested bucket
KeyValue(KVPair)
a key / value pair of bytes
Implementations
impl Data
[src]
pub fn is_kv(&self) -> bool
[src]
Checks if the Data
is a KVPair
pub fn kv(&self) -> &KVPair
[src]
Asserts that the Data
is a KVPair
and returns the inner data
This is an ergonomic function since data is wrapped up in a Ref
and matching is annoying
Trait Implementations
impl Clone for Data
[src]
impl Debug for Data
[src]
impl PartialEq<Data> for Data
[src]
impl StructuralPartialEq for Data
[src]
Auto Trait Implementations
impl RefUnwindSafe for Data
[src]
impl !Send for Data
[src]
impl !Sync for Data
[src]
impl Unpin for Data
[src]
impl UnwindSafe for Data
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,