|
@@ -50,6 +50,21 @@ impl Tree {
|
|
|
&self.tree
|
|
&self.tree
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// Returns the name of the tree.
|
|
|
|
|
+ pub fn name(&self) -> Result<String> {
|
|
|
|
|
+ #[cfg(feature = "sled-backend")]
|
|
|
|
|
+ {
|
|
|
|
|
+ match String::from_utf8(self.tree.name().to_vec()) {
|
|
|
|
|
+ Ok(s) => Ok(s),
|
|
|
|
|
+ Err(e) => Err(crate::Error::MalformedTreeMame(e.to_string())),
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #[cfg(feature = "fjall-backend")]
|
|
|
|
|
+ {
|
|
|
|
|
+ Ok(self.tree.name().to_string())
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// Returns true if the Tree contains a value for the specified key.
|
|
/// Returns true if the Tree contains a value for the specified key.
|
|
|
pub fn contains_key(&self, k: &[u8]) -> Result<bool> {
|
|
pub fn contains_key(&self, k: &[u8]) -> Result<bool> {
|
|
|
Ok(self.tree.contains_key(k)?)
|
|
Ok(self.tree.contains_key(k)?)
|