SetStorageItem

Function SetStorageItem 

Source
pub fn SetStorageItem(
    TargetObjectValue: Value,
    ValueToSet: Value,
) -> ActionEffect<Arc<dyn StorageProvider>, CommonError, ()>
Expand description

Creates an effect that, when executed, will set or update an item in either global or workspace-scoped Memento storage.

It uses the StorageProvider capability from the environment to perform the actual data persistence on the host.

§Parameters

  • TargetObjectValue: A serde_json::Value expected to be an object with the following fields:
    • Scope (boolean, optional): true for global scope, false or absent for workspace scope.
    • Key (string, required): The key of the item to set or update.
  • ValueToSet: The serde_json::Value to store. If this value is Value::Null, the effect will delete the item from storage.

§Returns

An ActionEffect that resolves to () on success.