pub struct SurrogateVault(/* private fields */);Expand description
Thread-safe, host-pinned vault mapping opaque <surrogate:kind:id> tokens to raw values.
Implementations§
Source§impl SurrogateVault
impl SurrogateVault
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new, empty SurrogateVault.
Sourcepub fn mint(
&self,
kind: &str,
raw_value: impl Into<String>,
) -> Result<SurrogateHandle, ToolError>
pub fn mint( &self, kind: &str, raw_value: impl Into<String>, ) -> Result<SurrogateHandle, ToolError>
Mint or retrieve an existing SurrogateHandle for (kind, raw_value).
§Errors
Returns ToolError if kind is empty or contains characters outside [a-zA-Z0-9_-],
raw_value is empty, or the vault lock is poisoned.
Sourcepub fn resolve_in_str_counted(
&self,
input: &str,
) -> Result<(String, usize), ToolError>
pub fn resolve_in_str_counted( &self, input: &str, ) -> Result<(String, usize), ToolError>
Resolve all <surrogate:kind:id> tokens embedded in input.
Returns Ok((resolved_string, replacement_count)) or fails closed with
ToolError if any <surrogate:...> token in input is malformed or unknown.
§Errors
Returns ToolError if an unknown/malformed surrogate token is encountered
or the vault lock is poisoned.
Sourcepub fn resolve_in_json(&self, value: &mut Value) -> Result<usize, ToolError>
pub fn resolve_in_json(&self, value: &mut Value) -> Result<usize, ToolError>
Recursively resolve all <surrogate:kind:id> tokens across string values inside value.
Returns the total number of resolved tokens. Fails closed with ToolError if any
surrogate token is unknown or malformed.
§Errors
Returns ToolError if an unknown/malformed surrogate token is encountered
or the vault lock is poisoned.