Expand description
Reading and writing the generated vocabulary types.
The types in crate::generated are read from a normalised document, the
form crate::read produces, and written in the same spelling. Their
field-by-field code is generated; what it calls is here, written by hand.
Reading is tolerant of values and strict about types. A property whose
value is not the shape its range allows is read as absent, because peers
send values nobody specified and one odd property should not cost the
whole object. An object whose type is not the one asked for is an error,
because reading a Like as a Follow is not tolerance.
Structs§
- Json
Error - Why a value could not be read.
- Text
- Natural-language text: a value in no particular language, and values per language.
Enums§
- Proof
Purpose - A Data Integrity proof’s purpose.
- Units
- A unit of length, as
Place.unitsgives one.
Traits§
- From
Json - A value that can be read from a normalised document.
- ToJson
- A value that can be written into a document in Ojak’s spelling.
- Typed
- A type documents name in their
type: what an inbox listener is registered for.
Functions§
- expect_
type - Check that
object’stypeisexpected. - has_
type - Whether
object’stypeisexpected, alone or among several. - id
object’sid.- link_
to_ image - A
Linkwhere anImageis expected, read as anImageof itshref. - many
- A property that may hold several values: the first of
keyspresent, and every one of its values that reads. - many_
mapped many, with each value adjusted bymapbefore it is read.- many_
with many, reading each value withread.- new_
object - Start writing an object.
- object
valueas an object.- one
- A property holding at most one value: the first of
keyspresent, and the first of its values that reads. - one_
mapped one, with each value adjusted bymapbefore it is read.- one_
with one, reading each value withread.- put_
many - Write a property that may hold several values under each of
keys: one value without an array, several with one, none not at all. - put_
many_ with put_many, writing each value withwrite.- put_one
- Write a property holding at most one value under each of
keys. - put_
one_ with put_one, writing the value withwrite.- put_
text - Write a text property as
keyand{key}Map, which is how peers that do not process JSON-LD expect to find it. - reference_
with - A reference, or an object read with
read: how a property whose values are sent without atypereads them. - text
- A text property, under
keyin either of its spellings: merged, as a normalised document has it, or split intokeyand{key}Map. - without_
type valuewithout itstype, for a property whose values are sent without one.- write_
reference - Write a reference, or an object with
write.