ToJson

Trait ToJson 

Source
pub trait ToJson {
    // Required method
    fn add_to_json_with(
        &self,
        value_map: &mut Map<String, Value>,
        opts: ValueOptions,
    );

    // Provided method
    fn to_json_with(&self, opts: ValueOptions) -> Value { ... }
}

Required Methods§

Source

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Provided Methods§

Implementations on Foreign Types§

Source§

impl ToJson for Annotation

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for ConstraintBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionTypeReference

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for BooleanSentence

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for ConstraintSentence

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for SimpleSentence

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Subject

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Term

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for PredicateSequenceMember

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for PredicateValue

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for TypeClassArgument

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for DimensionIdentity

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Definition

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for IdentifierReference

Source§

fn to_json_with(&self, opts: ValueOptions) -> Value

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for MemberKind

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for TypeReference

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Import

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for SequenceMember

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for SimpleValue

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Value

Convert a SDML Value into a context object, in the form shown as JSON below.

§Simple Value

{
    "__type": "boolean|double|decimal|integer|unsigned|string|uri|binary",
    "value": ...
}

§Value Constructor

{
    "__type": "constructor",
    "type_ref": "IdentifierReference",
    "value": {}
}

§Mapping

{
    "__type": "mapping",
    "domain": {},
    "range": {}
}

§Reference

{
    "__type": "type_ref",
    "value": "IdentifierReference",
}

§Sequence

{
    "__type": "sequence",
    "members": []
}
Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for AnnotationOnlyBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for AnnotationProperty

Convert a SDML AnnotationProperty into a context object, in the form shown as JSON below.

{
    "__type": "property",
    "source_span": {},              // optional
    "name": "IdentifierReference",  // optional
    "value": {}
}
Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionCardinality

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionDef

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionParameter

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionSignature

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionType

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for AtomicSentence

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for BinaryBooleanSentence

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Equation

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Inequation

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for QuantifiedSentence

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for QuantifiedVariable

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for QuantifiedVariableBinding

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for UnaryBooleanSentence

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Variable

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, _opts: ValueOptions, )

Source§

impl ToJson for SequenceBuilder

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FormalConstraint

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionComposition

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for FunctionalTerm

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for SequenceOfPredicateValues

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for ControlledLanguageString

Source§

fn add_to_json_with(&self, value_map: &mut Map<String, Value>, _: ValueOptions)

Source§

impl ToJson for Constraint

Convert a SDML Constraint into a context object, in the form shown as JSON below.

§Informal Constraint
{
    "__type": "informal",
    "source_span": {},              // optional
    "name": "Identifier",
    "value": "string",
    "language": ""                  // optional
}
§Formal Constraint
{
    "__type": "formal",
    "source_span": {},             // optional
    "name": "Identifier",
    "definitions": [],             // optional
    "sentence": {}
}
Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for MethodDef

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for TypeClassBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for TypeClassDef

Convert a SDML TypeClassDef into a context object, in the form shown as JSON below.

{
    "__type": "type_class",
    "source_span": {},              // optional
    "name": "Identifier",
    "variables": [],                // optional
    "methods": [],                  // optional
    "annotations": []               // optional
}
§Variable

TBD

§Method

TBD

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for TypeClassReference

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for TypeVariable

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for DatatypeDef

Convert a SDML DatatypeDef into a context object, in the form shown as JSON below.

{
    "__type": "datatype",
    "source_span": {},              // optional
    "name": "Identifier",
    "is_opaque": false,
    "base_type": "IdentifierReference",
    "annotations": []               // optional
}
Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for DimensionBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for DimensionDef

Convert a SDML DimensionDef into a context object, in the form shown as JSON below.

{
    "__type": "event",
    "source_span": {},              // optional
    "name": "Identifier",
    "entity": {...},                // SourceEntity or Member
    "parents": [],                  // optional
    "members": [],                  // optional
    "annotations": []               // optional
}

§DimensionParent

{
    "source_span": {},              // optional
    "name": "Identifier",
    "entity": "IdentifierReference",
    "annotations": []               // optional
}

§SourceEntity

{
    "__type": "source_entity",
    "source_span": {},              // optional
    "entity": "IdentifierReference",
    "members": []                   // optional
}

For members, see [member_to_value].

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for DimensionParent

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for SourceEntity

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for EntityBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for EntityDef

Convert a SDML EntityDef into a context object, in the form shown as JSON below.

{
    "__type": "entity",
    "source_span": {},              // optional
    "name": "Identifier",
    "identity": {},
    "members": [],                  // optional
    "annotations": []               // optional
}

For identity, see MemberDef and for members see Member, in [member_to_value].

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for EnumBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for EnumDef

Convert a SDML EnumDef into a context object, in the form shown as JSON below.

{
    "__type": "enum",
    "source_span": {},              // optional
    "name": "Identifier",
    "variants": [                   // optional
        {
            "name": "Identifier",
            "annotations": []       // optional
        }
    ],
    "annotations": []               // optional
}
Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for ValueVariant

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for EventBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for EventDef

Convert a SDML EventDef into a context object, in the form shown as JSON below.

{
    "__type": "event_def",
    "source_span": {},              // optional
    "name": "Identifier",
    "source_entity": {},             // SourceEntity
    "members": [],                  // optional
    "annotations": []               // optional
}

For members, see [member_to_value], and for event_source see [dimension_to_value].

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for PropertyDef

Convert a SDML PropertyDef into a context object, in the form shown as JSON below.

{
    "__type": "property",
    "source_span": {},              // optional
    "name": "Identifier",
    "cardinality": {
        "ordering": "",
        "uniqueness": "",
        "min_occurs": 1,
        "max_occurs": 0             // optional
    },
    "type_ref": "IdentifierReference"
}

For member see member definition in [member_to_value].

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for RdfDef

Convert a SDML RdfDef into a context object, in the form shown as JSON below.

{
    "__type": "rdf",
    "source_span": {},              // optional
    "name": "Identifier",
    "annotations": []               // optional
}
Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for StructureBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for StructureDef

Convert a SDML StructureDef into a context object, in the form shown as JSON below.

{
    "__type": "structure",
    "source_span": {},              // optional
    "name": "Identifier",
    "members": [],                  // optional
    "annotations": []               // optional
}

For members, see [member_to_value].

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for TypeVariant

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for UnionBody

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for UnionDef

Convert a SDML UnionDef into a context object, in the form shown as JSON below.

{
    "__type": "union",
    "source_span": {},              // optional
    "name": "Identifier",
    "variants": [                   // optional
        {
            "name": "IdentifierReference",
            "rename": "Identifier",
            "annotations": []
        }
    ],
    "annotations": []               // optional
}
Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Identifier

Source§

fn to_json_with(&self, opts: ValueOptions) -> Value

Source§

fn add_to_json_with(&self, value_map: &mut Map<String, Value>, _: ValueOptions)

Source§

impl ToJson for QualifiedIdentifier

Source§

fn to_json_with(&self, opts: ValueOptions) -> Value

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Cardinality

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Member

Convert a SDML Member into a context object, in the form shown as JSON below.

A member is either a reference to a property or a definition of a new member.

§Property Reference

{
    "__type": "reference",
    "type_ref": "IdentifierReference",
}

§Member Definition

{
    "__type": "definition",
    "source_span": {},              // optional
    "name": "Identifier",
    "cardinality": {
        "ordering": "",
        "uniqueness": "",
        "min_occurs": 1,
        "max_occurs": 0             // optional
    },
    "type_ref": "IdentifierReference"
}
Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for MemberDef

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for MappingType

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for ImportStatement

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for MemberImport

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Module

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for ModuleImport

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for Span

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for MappingValue

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for SequenceOfValues

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Source§

impl ToJson for ValueConstructor

Source§

fn add_to_json_with( &self, value_map: &mut Map<String, Value>, opts: ValueOptions, )

Implementors§