Skip to main content

Crate jsonld_syntax

Crate jsonld_syntax 

Source
Expand description

Syntax of JSON-LD contexts.

This crate provides the Rust types mirroring the JSON-LD grammar of a @context: context definitions, term definitions, keywords, container mappings, language tags and text directions. Each of them can be built from a JSON value with TryFromJson, converted back with IntoJson, and pretty-printed with the Print trait re-exported from jstrict.

Interpreting a context — resolving remote references, expanding terms into IRIs, compacting IRIs back into terms — is the job of the sibling jsonld-context-processing, jsonld-expansion and jsonld-compaction crates.

Re-exports§

pub use container::Container;
pub use container::ContainerKind;
pub use context::Context;
pub use context::ContextDocument;
pub use context::ContextEntry;

Modules§

container
Container mappings: the values a @container entry may take.
context
Contexts, their definitions and term definitions.
hash
Workspace-wide hasher selection.
intern
Process-wide string interner used by crate::context::definition::Key.
object
JSON objects.
parse
JSON parsing.
print
JSON printing.

Structs§

CompactIri
Compact IRI: a prefix and a suffix separated by a colon.
CompactIriBuf
Owned compact IRI.
InvalidCompactIri
Error raised when a string is not a compact IRI.
InvalidDirection
Error raised when a string is neither ltr nor rtl.
InvalidLangTag
Invalid langtag error.
KeywordType
The @type keyword, as a type of its own.
LangTag
Any language tag (normal, private use or grandfathered).
LangTagBuf
Owned langtag.
LenientLangTag
Language tag that may not be well-formed.
LenientLangTagBuf
Owned language tag that may not be well-formed.
NotAKeyword
Error raised when a string is not a JSON-LD keyword.
NullError
Error returned by Nullable::try_unwrap when the value is null.
Number
Lexical JSON number.
Object
Object.
Unexpected
Error raised when a JSON value has the wrong kind.
Unordered
Wrapper to view a value without considering the order of the objects entries.

Enums§

Direction
Internationalized string direction.
ErrorCode
JSON-LD error code.
ExpandableRef
Borrowed value that IRI expansion can be applied to.
Keyword
JSON-LD keywords.
Kind
Value kind.
Nullable
Value that can be null.
Value
JSON Value.

Traits§

BorrowUnordered
Free conversion from &T to &Unordered<T>.
Compare
Comparison ignoring the order of array items and object entries.
IntoJson
Values convertible into JSON.
IntoJsonWithContext
Values convertible into JSON through a vocabulary.
Parse
JSON parsing methods.
Print
Print methods.
TryFromJson
Values that can be built from a JSON value.
UnorderedEq
Marker trait stating that UnorderedPartialEq is an equivalence relation, mirroring Eq over PartialEq.
UnorderedHash
Hashing that ignores the order of object entries.
UnorderedPartialEq
Equality that ignores the order of object entries.

Functions§

from_valueserde
Deserializes the JSON value into an instance of type T.
is_keyword
Checks whether the given string is one of the JSON-LD keywords.
is_keyword_like
Checks whether the given string is keyword-like: an @ followed by one or more ASCII letters.
to_valueserde
Serializes the given value into a JSON Value.

Type Aliases§

NumberBuf
Number buffer.
String
String.