Skip to main content

encode

Function encode 

Source
pub fn encode(
    dto: &Value,
    provenance: &ProvStamp,
) -> Result<String, WorkbookToolError>
Expand description

Encode a validated input DTO + provenance stamp into a workbook:// render pointer URI.

The payload { dto, provenance } is serialized to canonical JSON then base64-encoded with the URL-safe, unpadded alphabet (so the result is a clean URI path segment). The bytes are NOT here — they are recomputed on resources/read from this URI.

§Errors

Returns WorkbookToolError::invalid_input only if the canonical DTO cannot be serialized (it always can for a super::input::ValidatedInput DTO; the fallible signature keeps the call site ?-chained and panic-free).