pub struct Descriptor {
pub lang: String,
pub body: String,
pub inputs: Vec<String>,
pub signature: Signature,
}Expand description
A function descriptor (7) in its spec-0.3.0 form: signature, code and declared inputs.
It has no place for the members spec-0.4.0 adds, signature.order and argument
extent, so from_json and from_value refuse a
descriptor that has them with E_SCHEMA, as in 0.3.3, rather than return a value whose
canonical bytes and hash would drop them. Read any
descriptor with FunctionDescriptor, which has both; FunctionDescriptor::to_descriptor
gives this form when neither is present.
Fields§
§lang: Stringcode.lang, e.g. stored.
body: Stringcode.body, opaque to this crate.
inputs: Vec<String>Fully qualified names of the functions this one may read, ascending.
signature: SignatureThe signature.
Implementations§
Source§impl Descriptor
impl Descriptor
Sourcepub fn from_json(bytes: &[u8]) -> Result<Descriptor>
pub fn from_json(bytes: &[u8]) -> Result<Descriptor>
Parses a descriptor from JSON text: strict JSON, structure, canonical form (7). A
descriptor with signature.order or an argument extent is E_SCHEMA here (see
Descriptor); use FunctionDescriptor::from_json.
Sourcepub fn from_value(v: &Value) -> Result<Descriptor>
pub fn from_value(v: &Value) -> Result<Descriptor>
Checks a parsed JSON value as a descriptor; E_SCHEMA for order or extent, as
from_json.