Struct matterdb::IndexAddress [−][src]
Represents the address of an index in the database.
An address has a string name and an optional byte key. An index is uniquely identified
by its address. Different addresses correspond to different indexes. Addresses with the same
name and differing keys are said to belong to the same group (see also Group
). Groups
can be used for a potentially unbounded group of indexes that can be identified by a certain
key (for example, ListIndex
with the transaction history of a wallet keyed by the
PublicKey
of the wallet).
In contrast with ResolvedAddress
, IndexAddress
is a high-level logical construct;
it does not directly map to key-value storage abstractions (column families and their keys).
Examples
IndexAddress
can be used implicitly, since &str
and (&str, &impl BinaryKey)
can both
be converted into an address.
use matterdb::{access::CopyAccessExt, IndexAddress, TemporaryDB, Database}; let db = TemporaryDB::new(); let fork = db.fork(); // Using a string address: let map = fork.get_map::<_, String, u8>("map"); // Using an address within an index family: let list = fork.get_list::<_, String>(("index", &3_u32)); // Using `IndexAddress` explicitly: let addr = IndexAddress::from_root("data").append_key(&vec![1, 2, 3]); let set = fork.get_key_set::<_, u64>(addr);
Implementations
impl IndexAddress
[src]
pub fn from_root<S: Into<String>>(root: S) -> Self
[src]
Creates new IndexAddress
with the specified name.
pub fn name(&self) -> &str
[src]
Returns the name part of IndexAddress
.
pub fn id_in_group(&self) -> Option<&[u8]>
[src]
Returns the bytes part of IndexAddress
.
pub fn prepend_name(self, prefix: &str) -> Self
[src]
Prepends a name part to IndexAddress
. The name is separated from the existing name
by a dot .
.
Examples
let addr = IndexAddress::from_root("foo"); let prefixed = addr.prepend_name("prefix"); assert_eq!(prefixed.name(), "prefix.foo");
pub fn append_name(self, suffix: &str) -> Self
[src]
Appends a name part to IndexAddress
. The name is separated from the existing name
by a dot .
.
Examples
let addr = IndexAddress::from_root("foo"); let suffixed = addr.append_name("suffix"); assert_eq!(suffixed.name(), "foo.suffix");
pub fn append_key<K: BinaryKey + ?Sized>(self, suffix: &K) -> Self
[src]
Appends a key to the IndexAddress
.
Trait Implementations
impl Clone for IndexAddress
[src]
fn clone(&self) -> IndexAddress
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for IndexAddress
[src]
impl Default for IndexAddress
[src]
fn default() -> IndexAddress
[src]
impl Eq for IndexAddress
[src]
impl From<&'_ str> for IndexAddress
[src]
impl<'a, K: BinaryKey + ?Sized> From<(&'a str, &'a K)> for IndexAddress
[src]
impl From<String> for IndexAddress
[src]
impl Hash for IndexAddress
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<IndexAddress> for IndexAddress
[src]
fn eq(&self, other: &IndexAddress) -> bool
[src]
fn ne(&self, other: &IndexAddress) -> bool
[src]
impl StructuralEq for IndexAddress
[src]
impl StructuralPartialEq for IndexAddress
[src]
Auto Trait Implementations
impl RefUnwindSafe for IndexAddress
impl Send for IndexAddress
impl Sync for IndexAddress
impl Unpin for IndexAddress
impl UnwindSafe for IndexAddress
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> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,