pub struct DocStore { /* private fields */ }Expand description
A document-oriented Store providing ergonomic access to Doc CRDT data.
DocStore wraps the Doc CRDT to provide path-based access to nested
document structures. It supports string values and deletions via tombstones.
§API Overview
- Basic operations:
get,set,delete,get_all,contains_key - Path operations:
get_path,set_path,contains_path - Path mutation:
modify_path,get_or_insert_path,modify_or_insert_path
Implementations§
Source§impl DocStore
impl DocStore
Sourcepub async fn get(&self, key: impl AsRef<str>) -> Result<Value>
pub async fn get(&self, key: impl AsRef<str>) -> Result<Value>
Gets a value associated with a key from the Store.
This method prioritizes returning data staged within the current Transaction.
If the key is not found in the staged data it retrieves the fully merged historical
state from the backend up to the point defined by the Transaction’s parents and
returns the value from there.
§Arguments
key- The key to retrieve the value for.
§Returns
A Result containing the MapValue if found, or Error::NotFound.
Sourcepub async fn get_option(&self, key: impl AsRef<str>) -> Option<Value>
pub async fn get_option(&self, key: impl AsRef<str>) -> Option<Value>
Gets a value associated with a key from the Store (HashMap-like API).
This method returns an Option for compatibility with std::HashMap.
Returns None if the key is not found or is deleted.
§Arguments
key- The key to retrieve the value for.
§Returns
An Option containing the cloned Value if found, or None.
Sourcepub async fn get_result(&self, key: impl AsRef<str>) -> Result<Value>
pub async fn get_result(&self, key: impl AsRef<str>) -> Result<Value>
Gets a value associated with a key from the Store (Result-based API for backward compatibility).
This method prioritizes returning data staged within the current Transaction.
If the key is not found in the staged data it retrieves the fully merged historical
state from the backend up to the point defined by the Transaction’s parents and
returns the value from there.
§Arguments
key- The key to retrieve the value for.
§Returns
A Result containing the MapValue if found, or Error::NotFound.
Sourcepub async fn get_string(&self, key: impl AsRef<str>) -> Result<String>
pub async fn get_string(&self, key: impl AsRef<str>) -> Result<String>
Gets a string value associated with a key from the Store.
This is a convenience method that calls get() and expects the value to be a string.
§Arguments
key- The key to retrieve the value for.
§Returns
A Result containing the string value if found, or an error if the key is not found
or if the value is not a string.
Sourcepub async fn set(
&self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Result<()>
pub async fn set( &self, key: impl Into<String>, value: impl Into<Value>, ) -> Result<()>
Stages the setting of a key-value pair within the associated Transaction.
This method updates the Map data held within the Transaction for this
Doc instance’s subtree name. The change is not persisted to the backend
until the Transaction::commit() method is called.
§Arguments
key- The key to set.value- The value to associate with the key (can be &str, String, Value, etc.)
§Returns
A Result<()> indicating success or an error during serialization or staging.
Sourcepub async fn insert(
&self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Result<Option<Value>>
pub async fn insert( &self, key: impl Into<String>, value: impl Into<Value>, ) -> Result<Option<Value>>
Sets a key-value pair (HashMap-like API).
Returns the previous value if one existed, or None if the key was not present. This follows std::HashMap::insert() semantics.
§Arguments
key- The key to set.value- The value to associate with the key (can be &str, String, Value, etc.)
§Returns
A Result<Option<Value>> containing the previous value, or None if no previous value.
Sourcepub async fn set_result(
&self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Result<()>
pub async fn set_result( &self, key: impl Into<String>, value: impl Into<Value>, ) -> Result<()>
Sets a key-value pair (Result-based API for backward compatibility).
This method updates the Map data held within the Transaction for this
Doc instance’s subtree name. The change is not persisted to the backend
until the Transaction::commit() method is called.
§Arguments
key- The key to set.value- The value to associate with the key (can be &str, String, Value, etc.)
§Returns
A Result<()> indicating success or an error during serialization or staging.
Sourcepub async fn set_string(
&self,
key: impl Into<String>,
value: impl Into<String>,
) -> Result<()>
pub async fn set_string( &self, key: impl Into<String>, value: impl Into<String>, ) -> Result<()>
Convenience method to set a string value.
Sourcepub async fn get_list(&self, key: impl AsRef<str>) -> Result<List>
pub async fn get_list(&self, key: impl AsRef<str>) -> Result<List>
Stages the setting of a nested value within the associated Transaction.
This method allows setting any valid Value type (String, Map, or Deleted).
§Arguments
key- The key to set.value- The Value to associate with the key.
§Returns
A Result<()> indicating success or an error during serialization or staging.
Convenience method to get a List value.
Sourcepub async fn get_node(&self, key: impl AsRef<str>) -> Result<Doc>
pub async fn get_node(&self, key: impl AsRef<str>) -> Result<Doc>
Convenience method to get a nested Doc value.
Sourcepub async fn set_list(
&self,
key: impl Into<String>,
list: impl Into<List>,
) -> Result<()>
pub async fn set_list( &self, key: impl Into<String>, list: impl Into<List>, ) -> Result<()>
Convenience method to set a list value.
Sourcepub async fn set_node(
&self,
key: impl Into<String>,
node: impl Into<Doc>,
) -> Result<()>
pub async fn set_node( &self, key: impl Into<String>, node: impl Into<Doc>, ) -> Result<()>
Convenience method to set a nested Doc value.
Sourcepub async fn set_value(
&self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Result<()>
pub async fn set_value( &self, key: impl Into<String>, value: impl Into<Value>, ) -> Result<()>
Legacy method for backward compatibility - now just an alias to set
Sourcepub async fn get_value(&self, key: impl AsRef<str>) -> Result<Value>
pub async fn get_value(&self, key: impl AsRef<str>) -> Result<Value>
Legacy method for backward compatibility - now just an alias to get
Sourcepub async fn get_path(&self, path: impl AsRef<Path>) -> Result<Value>
pub async fn get_path(&self, path: impl AsRef<Path>) -> Result<Value>
Enhanced access methods with type inference
These methods provide cleaner access with automatic type conversion, similar to the CRDT Doc interface but adapted for the DocStore transaction model.
Gets a value by path using dot notation (e.g., “user.profile.name”)
Traverses the DocStore data structure following the path segments separated by dots. This method follows the DocStore staging model by checking local staged data first, then falling back to historical data from the backend.
§Path Syntax
- Docs: Navigate by key name (e.g., “user.profile.name”)
- Lists: Navigate by index (e.g., “items.0.title”)
- Mixed: Combine both (e.g., “users.0.tags.1”)
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
store.set_path(path!("user.profile.name"), "Alice").await?;
// Navigate nested structure
let name = store.get_path(path!("user.profile.name")).await?;§Returns
A Result<Value> containing the value if found, or an error if not found.
Source§impl DocStore
impl DocStore
Sourcepub async fn get_as<T>(&self, key: impl AsRef<str>) -> Result<T>
pub async fn get_as<T>(&self, key: impl AsRef<str>) -> Result<T>
Gets a value with automatic type conversion using TryFrom.
This provides a generic interface that can convert to any type that implements
TryFrom<&Value>, making the API more ergonomic by reducing type specification.
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
store.set("name", "Alice").await?;
store.set("age", 30).await?;
// Type inference makes this clean
let name: String = store.get_as("name").await?;
let age: i64 = store.get_as("age").await?;
assert_eq!(name, "Alice");
assert_eq!(age, 30);Sourcepub async fn get_path_as<T>(&self, path: impl AsRef<Path>) -> Result<T>
pub async fn get_path_as<T>(&self, path: impl AsRef<Path>) -> Result<T>
Gets a value by path with automatic type conversion using TryFrom
Similar to get_as() but works with dot-notation paths for nested access.
This method follows the DocStore staging model by checking local staged data first,
then falling back to historical data from the backend.
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
// Assuming nested structure exists
// Type inference with path access
let name: String = store.get_path_as(path!("user.profile.name")).await?;
let age: i64 = store.get_path_as(path!("user.profile.age")).await?;
assert_eq!(name, "Alice");
assert_eq!(age, 30);§Errors
Returns an error if:
- The path doesn’t exist (
SubtreeError::KeyNotFound) - The value cannot be converted to type T (
CRDTError::TypeMismatch) - The DocStore operation fails
Sourcepub async fn get_or_insert<T>(
&self,
key: impl AsRef<str>,
default: T,
) -> Result<T>
pub async fn get_or_insert<T>( &self, key: impl AsRef<str>, default: T, ) -> Result<T>
Mutable access methods for transaction-based modification
These methods work with DocStore’s staging model, where changes are staged in the Transaction transaction rather than modified in-place.
Get or insert a value with a default.
If the key exists (in either local staging area or historical data), returns the existing value. If the key doesn’t exist, sets it to the default value and returns that.
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
// Key doesn't exist - will set default
let count1: i64 = store.get_or_insert("counter", 0).await?;
assert_eq!(count1, 0);
// Key exists - will return existing value
store.set("counter", 5).await?;
let count2: i64 = store.get_or_insert("counter", 100).await?;
assert_eq!(count2, 5);Sourcepub async fn modify<T, F>(&self, key: impl AsRef<str>, f: F) -> Result<()>
pub async fn modify<T, F>(&self, key: impl AsRef<str>, f: F) -> Result<()>
Modifies a value in-place using a closure
If the key exists and can be converted to type T, the closure is called with the value. After the closure returns, the modified value is staged back to the DocStore.
This method handles the DocStore staging model by:
- Getting the current value (from local staging or historical data)
- Converting it to the desired type
- Applying the modification closure
- Staging the result back to the Transaction
§Errors
Returns an error if:
- The key doesn’t exist (
SubtreeError::KeyNotFound) - The value cannot be converted to type T (
CRDTError::TypeMismatch) - Setting the value fails
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
store.set("count", 5).await?;
store.set("text", "hello").await?;
// Modify counter
store.modify::<i64, _>("count", |count| {
*count += 10;
}).await?;
assert_eq!(store.get_as::<i64>("count").await?, 15);
// Modify string
store.modify::<String, _>("text", |text| {
text.push_str(" world");
}).await?;
assert_eq!(store.get_as::<String>("text").await?, "hello world");Sourcepub async fn modify_or_insert<T, F>(
&self,
key: impl AsRef<str>,
default: T,
f: F,
) -> Result<()>
pub async fn modify_or_insert<T, F>( &self, key: impl AsRef<str>, default: T, f: F, ) -> Result<()>
Modify a value or insert a default if it doesn’t exist.
This is a combination of get_or_insert and modify that ensures
the key exists before modification.
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
// Key doesn't exist - will create with default then modify
store.modify_or_insert::<i64, _>("counter", 0, |count| {
*count += 5;
}).await?;
assert_eq!(store.get_as::<i64>("counter").await?, 5);
// Key exists - will just modify
store.modify_or_insert::<i64, _>("counter", 100, |count| {
*count *= 2;
}).await?;
assert_eq!(store.get_as::<i64>("counter").await?, 10);Sourcepub async fn get_or_insert_path<T>(
&self,
path: impl AsRef<Path>,
default: T,
) -> Result<T>
pub async fn get_or_insert_path<T>( &self, path: impl AsRef<Path>, default: T, ) -> Result<T>
Get or insert a value at a path with a default, similar to get_or_insert but for paths
If the path exists (in either local staging area or historical data), returns the existing value. If the path doesn’t exist, sets it to the default value and returns that. Intermediate nodes are created as needed.
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
// Path doesn't exist - will create structure and set default
let count1: i64 = store.get_or_insert_path(path!("user.stats.score"), 0).await?;
assert_eq!(count1, 0);
// Path exists - will return existing value
store.set_path(path!("user.stats.score"), 42).await?;
let count2: i64 = store.get_or_insert_path(path!("user.stats.score"), 100).await?;
assert_eq!(count2, 42);Sourcepub async fn get_or_insert_path_str<T>(
&self,
path: &str,
default: T,
) -> Result<T>
pub async fn get_or_insert_path_str<T>( &self, path: &str, default: T, ) -> Result<T>
Get or insert a value at a path with string paths for runtime normalization
Sourcepub async fn modify_or_insert_path<T, F>(
&self,
path: impl AsRef<Path>,
default: T,
f: F,
) -> Result<()>
pub async fn modify_or_insert_path<T, F>( &self, path: impl AsRef<Path>, default: T, f: F, ) -> Result<()>
Modify a value at a path or insert a default if it doesn’t exist.
This is a combination of get_or_insert_path and modify_path that ensures
the path exists before modification, creating intermediate structure as needed.
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
// Path doesn't exist - will create structure with default then modify
store.modify_or_insert_path::<i64, _>(path!("user.stats.score"), 0, |score| {
*score += 10;
}).await?;
assert_eq!(store.get_path_as::<i64>(path!("user.stats.score")).await?, 10);
// Path exists - will just modify
store.modify_or_insert_path::<i64, _>(path!("user.stats.score"), 100, |score| {
*score *= 2;
}).await?;
assert_eq!(store.get_path_as::<i64>(path!("user.stats.score")).await?, 20);Sourcepub async fn modify_or_insert_path_str<T, F>(
&self,
path: &str,
default: T,
f: F,
) -> Result<()>
pub async fn modify_or_insert_path_str<T, F>( &self, path: &str, default: T, f: F, ) -> Result<()>
Modify a value or insert a default with string paths for runtime normalization
Sourcepub async fn set_path(
&self,
path: impl AsRef<Path>,
value: impl Into<Value>,
) -> Result<()>
pub async fn set_path( &self, path: impl AsRef<Path>, value: impl Into<Value>, ) -> Result<()>
Sets a value at the given path, creating intermediate nodes as needed
This method stages a path-based set operation in the Transaction transaction. The path uses dot notation to navigate and create nested map structures. Intermediate maps are created automatically where necessary.
§Important: Creates Nested Maps, Not Flat Keys
Using dots in the path creates a hierarchy of nested maps, not flat keys with dots.
For example, set_path("user.name", "Alice") creates:
{
"user": {
"name": "Alice"
}
}NOT: { "user.name": "Alice" }
§Path Syntax
- Docs: Navigate by key name (e.g., “user.profile.name”)
- Creating structure: Intermediate nodes are created automatically
- Overwriting: If a path segment points to a non-node value, it will be overwritten
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
// Set nested values, creating structure as needed
store.set_path(path!("user.profile.name"), "Alice").await?;
store.set_path(path!("user.profile.age"), 30).await?;
store.set_path(path!("user.settings.theme"), "dark").await?;
// This creates nested structure:
// {
// "user": {
// "profile": { "name": "Alice", "age": 30 },
// "settings": { "theme": "dark" }
// }
// }
// Access with get_path methods
assert_eq!(store.get_path_as::<String>(path!("user.profile.name")).await?, "Alice");
// Or navigate the nested structure manually from get_all()
let all = store.get_all().await?;
// all.get("user") returns a Doc, NOT all.get("user.profile.name")
if let Some(Value::Doc(user)) = all.get("user") {
if let Some(Value::Doc(profile)) = user.get("profile") {
assert_eq!(profile.get("name"), Some(&Value::Text("Alice".to_string())));
}
}§Errors
Returns an error if:
- The path is empty
- A non-final segment contains a non-node value that cannot be navigated through
- The DocStore operation fails
Sourcepub async fn set_path_str(
&self,
path: &str,
value: impl Into<Value>,
) -> Result<()>
pub async fn set_path_str( &self, path: &str, value: impl Into<Value>, ) -> Result<()>
Sets a value at the given path with string paths for runtime normalization
Sourcepub async fn modify_path<T, F>(
&self,
path: impl AsRef<Path>,
f: F,
) -> Result<()>
pub async fn modify_path<T, F>( &self, path: impl AsRef<Path>, f: F, ) -> Result<()>
Modifies a value at a path in-place using a closure
Similar to modify() but works with dot-notation paths for nested access.
This method follows the DocStore staging model by checking local staged data
first, then falling back to historical data from the backend.
§Errors
Returns an error if:
- The path doesn’t exist (
SubtreeError::KeyNotFound) - The value cannot be converted to type T (
CRDTError::TypeMismatch) - Setting the path fails (
CRDTError::InvalidPath)
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
store.set_path(path!("user.score"), 100).await?;
store.modify_path::<i64, _>(path!("user.score"), |score| {
*score += 50;
}).await?;
assert_eq!(store.get_path_as::<i64>(path!("user.score")).await?, 150);Sourcepub async fn modify_path_str<T, F>(&self, path: &str, f: F) -> Result<()>
pub async fn modify_path_str<T, F>(&self, path: &str, f: F) -> Result<()>
Modify a value at a path with string paths for runtime normalization
Sourcepub async fn delete(&self, key: impl AsRef<str>) -> Result<bool>
pub async fn delete(&self, key: impl AsRef<str>) -> Result<bool>
Stages the deletion of a key within the associated Transaction.
This method removes the key-value pair from the Map data held within
the Transaction for this Doc instance’s subtree name. A tombstone is created,
which will propagate the deletion when merged with other data. The change is not
persisted to the backend until the Transaction::commit() method is called.
When using the get method, deleted keys will return Error::NotFound. However,
the deletion is still tracked internally as a tombstone, which ensures that the
deletion propagates correctly when merging with other versions of the data.
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("my_data").await?;
// First set a value
store.set("user1", "Alice").await?;
// Later delete the value
store.delete("user1").await?;
// Attempting to get the deleted key will return NotFound
assert!(store.get("user1").await.is_err());
// You can verify the tombstone exists by checking the full state
let all_data = store.get_all().await?;
assert!(all_data.is_tombstone("user1"));§Arguments
key- The key to delete.
§Returns
Ok(true)if the key existed and was deletedOk(false)if the key did not exist (no-op)Erron serialization or staging errors
Sourcepub async fn get_all(&self) -> Result<Doc>
pub async fn get_all(&self) -> Result<Doc>
Retrieves all key-value pairs as a Doc, merging staged and historical state.
This method combines the data staged within the current Transaction with the
fully merged historical state from the backend, providing a complete view
of the document as it would appear if the transaction were committed.
The staged data takes precedence in case of conflicts (overwrites).
§Important: Understanding Nested Structure
When using set_path() with dot-notation paths, the data is stored as nested maps.
The returned Doc will contain the top-level keys, with nested structures as Value::Doc values.
§Example:
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
// Using set_path creates nested structure
store.set_path(path!("user.name"), "Alice").await?;
store.set_path(path!("user.age"), 30).await?;
store.set_path(path!("config.theme"), "dark").await?;
let all_data = store.get_all().await?;
// The top-level map has keys "user" and "config", NOT "user.name", "user.age", etc.
assert_eq!(all_data.len(), 2); // Only 2 top-level keys
// To access nested data from get_all():
if let Some(Value::Doc(user_node)) = all_data.get("user") {
// user_node contains "name" and "age" as its children
assert_eq!(user_node.get("name"), Some(&Value::Text("Alice".to_string())));
assert_eq!(user_node.get("age"), Some(&Value::Text("30".to_string())));
}
// For direct access, use get_path() or get_path_as() instead:
assert_eq!(store.get_path_as::<String>(path!("user.name")).await?, "Alice");§Returns
A Result containing the merged Doc data structure with nested maps for path-based data.
Sourcepub async fn contains_key(&self, key: impl AsRef<str>) -> bool
pub async fn contains_key(&self, key: impl AsRef<str>) -> bool
Returns true if the DocStore contains the given key
This method checks both local staged data and historical backend data following the DocStore staging model. A key is considered to exist if:
- It exists in local staged data (and is not deleted)
- It exists in backend data (and is not deleted)
Deleted keys (tombstones) are treated as non-existent.
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
assert!(!store.contains_key("missing").await); // Key doesn't exist
store.set("name", "Alice").await?;
assert!(store.contains_key("name").await); // Key exists in staging
store.delete("name").await?;
assert!(!store.contains_key("name").await); // Key deleted (tombstone)Sourcepub async fn contains_path(&self, path: impl AsRef<Path>) -> bool
pub async fn contains_path(&self, path: impl AsRef<Path>) -> bool
Returns true if the DocStore contains the given path
This method checks both local staged data and historical backend data following the DocStore staging model. A path is considered to exist if:
- The complete path exists and points to a non-deleted value
- All intermediate segments are navigable (nodes or lists)
§Path Syntax
Uses the same dot notation as other path methods:
- Docs: Navigate by key name (e.g., “user.profile.name”)
- Lists: Navigate by index (e.g., “items.0.title”)
- Mixed: Combine both (e.g., “users.0.tags.1”)
§Examples
let txn = database.new_transaction().await?;
let store = txn.get_store::<DocStore>("data").await?;
assert!(!store.contains_path(path!("user.name")).await); // Path doesn't exist
store.set_path(path!("user.profile.name"), "Alice").await?;
assert!(store.contains_path(path!("user")).await); // Intermediate path exists
assert!(store.contains_path(path!("user.profile")).await); // Intermediate path exists
assert!(store.contains_path(path!("user.profile.name")).await); // Full path exists
assert!(!store.contains_path(path!("user.profile.age")).await); // Path doesn't existSourcepub async fn contains_path_str(&self, path: &str) -> bool
pub async fn contains_path_str(&self, path: &str) -> bool
Returns true if the DocStore contains the given path with string paths for runtime normalization
Source§impl DocStore
impl DocStore
Sourcepub fn get_value_mut(&self, key: impl Into<String>) -> ValueEditor<'_>
pub fn get_value_mut(&self, key: impl Into<String>) -> ValueEditor<'_>
Gets a mutable editor for a value associated with the given key.
If the key does not exist, the editor will be initialized with an empty map,
allowing immediate use of map-modifying methods. The type can be changed
later using ValueEditor::set().
Changes made via the ValueEditor are staged in the Transaction by its set method
and must be committed via Transaction::commit() to be persisted to the Doc’s backend.
Sourcepub fn get_root_mut(&self) -> ValueEditor<'_>
pub fn get_root_mut(&self) -> ValueEditor<'_>
Gets a mutable editor for the root of this Doc’s subtree.
Changes made via the ValueEditor are staged in the Transaction by its set method
and must be committed via Transaction::commit() to be persisted to the Doc’s backend.
Sourcepub async fn get_at_path<S, P>(&self, path: P) -> Result<Value>
pub async fn get_at_path<S, P>(&self, path: P) -> Result<Value>
Retrieves a Value from the Doc using a specified path.
The path is a slice of strings, where each string is a key in the
nested map structure. If the path is empty, it retrieves the entire
content of this Doc’s named subtree as a Value::Doc.
This method operates on the fully merged view of the Doc’s data,
including any local changes from the current Transaction layered on top
of the backend state.
§Arguments
path: A slice ofStringrepresenting the path to the desired value.
§Errors
Error::NotFoundif any segment of the path does not exist (for non-empty paths), or if the final value or an intermediate value is aValue::Deleted(tombstone).Error::IowithErrorKind::InvalidDataif a non-map value is encountered during path traversal where a map was expected.
Sourcepub async fn set_at_path<S, P>(&self, path: P, value: Value) -> Result<()>
pub async fn set_at_path<S, P>(&self, path: P, value: Value) -> Result<()>
Sets a Value at a specified path within the Doc’s Transaction.
The path is a slice of strings, where each string is a key in the nested map structure.
This method modifies the local data associated with the Transaction. The changes
are not persisted to the backend until Transaction::commit() is called.
If the path does not exist, it will be created. Intermediate non-map values
in the path will be overwritten by maps as needed to complete the path.
§Arguments
path: A slice ofStringrepresenting the path where the value should be set.value: TheValueto set at the specified path.
§Errors
Error::InvalidOperationif thepathis empty andvalueis not aValue::Doc.Error::Serializeif the updated subtree data cannot be serialized to JSON.- Potentially other errors from
Transaction::update_subtree.
Trait Implementations§
Source§impl Registered for DocStore
impl Registered for DocStore
Source§impl Store for DocStore
impl Store for DocStore
Source§fn new<'life0, 'async_trait>(
txn: &'life0 Transaction,
subtree_name: String,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn new<'life0, 'async_trait>(
txn: &'life0 Transaction,
subtree_name: String,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store handle associated with a specific transaction. Read moreSource§fn transaction(&self) -> &Transaction
fn transaction(&self) -> &Transaction
Source§fn default_config() -> Doc
fn default_config() -> Doc
Source§fn init<'life0, 'async_trait>(
txn: &'life0 Transaction,
subtree_name: String,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn init<'life0, 'async_trait>(
txn: &'life0 Transaction,
subtree_name: String,
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
_index. Read moreSource§fn get_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Doc>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_config<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Doc>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
_index subtree. Read moreSource§fn set_config<'life0, 'async_trait>(
&'life0 self,
config: Doc,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_config<'life0, 'async_trait>(
&'life0 self,
config: Doc,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
_index subtree. Read moreSource§fn get_height_strategy<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<HeightStrategy>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_height_strategy<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<HeightStrategy>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
_index subtree. Read moreAuto Trait Implementations§
impl Freeze for DocStore
impl !RefUnwindSafe for DocStore
impl Send for DocStore
impl Sync for DocStore
impl Unpin for DocStore
impl !UnwindSafe for DocStore
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more