Skip to main content

encode

Function encode 

Source
pub fn encode(
    catalog: &Catalog,
    ty: &Type,
    value: &Value,
) -> Result<Json, EncodeError>
Expand description

Returns value, of type ty, as JSON.

The encoding carries no type tags: the type decides it.

ยงErrors

A value that does not have the type, and a type with no encoding, are EncodeErrors; a checked program reaches neither.