pub trait Table<M>: Sized {
type Counts;
type Error: From<Error>;
type Key;
type KeyBytes: AsRef<[u8]>;
type Value;
type ValueBytes: AsRef<[u8]>;
type Index;
type IndexBytes: AsRef<[u8]>;
Show 22 methods
// Required methods
fn database(&self) -> &Database<M>;
fn from_database(database: Database<M>) -> Self;
fn get_counts(&self) -> Result<Self::Counts, Self::Error>;
fn key_to_bytes(key: &Self::Key) -> Result<Self::KeyBytes, Self::Error>;
fn value_to_bytes(
value: &Self::Value,
) -> Result<Self::ValueBytes, Self::Error>;
fn index_to_bytes(
index: &Self::Index,
) -> Result<Self::IndexBytes, Self::Error>;
fn bytes_to_key(bytes: Cow<'_, [u8]>) -> Result<Self::Key, Self::Error>;
fn bytes_to_value(bytes: Cow<'_, [u8]>) -> Result<Self::Value, Self::Error>;
// Provided methods
fn default_compression_type() -> Option<DBCompressionType> { ... }
fn statistics(&self) -> Option<String> { ... }
fn get_estimated_key_count(&self) -> Result<Option<u64>, Error> { ... }
fn open_with_defaults<P: AsRef<Path>>(path: P) -> Result<Self, Error>
where M: SinglePath { ... }
fn open_as_secondary_with_defaults<P: AsRef<Path>, S: AsRef<Path>>(
path: P,
secondary_path: S,
) -> Result<Self, Error>
where M: IsSecondary { ... }
fn open<P: AsRef<Path>, F: FnMut(Options) -> Options>(
path: P,
options_init: F,
) -> Result<Self, Error>
where M: SinglePath { ... }
fn open_as_secondary<P: AsRef<Path>, S: AsRef<Path>, F: FnMut(Options) -> Options>(
path: P,
secondary_path: S,
options_init: F,
) -> Result<Self, Error>
where M: IsSecondary { ... }
fn iter(&self) -> TableIterator<'_, M, Self> ⓘ
where M: 'static { ... }
fn iter_selected_values<P: Fn(&Self::Key) -> bool>(
&self,
pred: P,
) -> SelectedValueTableIterator<'_, M, Self, P> ⓘ
where M: 'static { ... }
fn lookup_key(
&self,
key: &Self::Key,
) -> Result<Option<Self::Value>, Self::Error> { ... }
fn lookup_index(&self, index: &Self::Index) -> IndexIterator<'_, M, Self> ⓘ
where M: 'static { ... }
fn lookup_index_selected_values<P: Fn(&Self::Key) -> bool>(
&self,
index: &Self::Index,
pred: P,
) -> SelectedValueIndexIterator<'_, M, Self, P> ⓘ
where M: 'static { ... }
fn put(
&self,
key: &Self::Key,
value: &Self::Value,
) -> Result<(), Self::Error>
where M: IsWriteable { ... }
fn catch_up_with_primary(&self) -> Result<(), Self::Error>
where M: IsSecondary { ... }
}
Expand description
A database table.
Required Associated Types§
type Counts
type Error: From<Error>
type Key
type KeyBytes: AsRef<[u8]>
type Value
type ValueBytes: AsRef<[u8]>
type Index
type IndexBytes: AsRef<[u8]>
Required Methods§
fn database(&self) -> &Database<M>
fn from_database(database: Database<M>) -> Self
fn get_counts(&self) -> Result<Self::Counts, Self::Error>
fn key_to_bytes(key: &Self::Key) -> Result<Self::KeyBytes, Self::Error>
fn value_to_bytes(value: &Self::Value) -> Result<Self::ValueBytes, Self::Error>
fn index_to_bytes(index: &Self::Index) -> Result<Self::IndexBytes, Self::Error>
fn bytes_to_key(bytes: Cow<'_, [u8]>) -> Result<Self::Key, Self::Error>
fn bytes_to_value(bytes: Cow<'_, [u8]>) -> Result<Self::Value, Self::Error>
Provided Methods§
fn default_compression_type() -> Option<DBCompressionType>
fn statistics(&self) -> Option<String>
fn get_estimated_key_count(&self) -> Result<Option<u64>, Error>
fn open_with_defaults<P: AsRef<Path>>(path: P) -> Result<Self, Error>where
M: SinglePath,
fn open_as_secondary_with_defaults<P: AsRef<Path>, S: AsRef<Path>>(
path: P,
secondary_path: S,
) -> Result<Self, Error>where
M: IsSecondary,
fn open<P: AsRef<Path>, F: FnMut(Options) -> Options>(
path: P,
options_init: F,
) -> Result<Self, Error>where
M: SinglePath,
fn open_as_secondary<P: AsRef<Path>, S: AsRef<Path>, F: FnMut(Options) -> Options>(
path: P,
secondary_path: S,
options_init: F,
) -> Result<Self, Error>where
M: IsSecondary,
fn iter(&self) -> TableIterator<'_, M, Self> ⓘwhere
M: 'static,
fn iter_selected_values<P: Fn(&Self::Key) -> bool>(
&self,
pred: P,
) -> SelectedValueTableIterator<'_, M, Self, P> ⓘwhere
M: 'static,
fn lookup_key( &self, key: &Self::Key, ) -> Result<Option<Self::Value>, Self::Error>
fn lookup_index(&self, index: &Self::Index) -> IndexIterator<'_, M, Self> ⓘwhere
M: 'static,
fn lookup_index_selected_values<P: Fn(&Self::Key) -> bool>(
&self,
index: &Self::Index,
pred: P,
) -> SelectedValueIndexIterator<'_, M, Self, P> ⓘwhere
M: 'static,
fn put(&self, key: &Self::Key, value: &Self::Value) -> Result<(), Self::Error>where
M: IsWriteable,
fn catch_up_with_primary(&self) -> Result<(), Self::Error>where
M: IsSecondary,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.