Crate relay_protocol

Source
Expand description

Types and traits for building JSON-based protocols and schemas

This crate provides the types and aliases that are used for the meta part of the protocol. This is the core annotation system as well as the dynamic value parts and the metadata that goes with it.

§Test Utilities

When the test feature is enabled, this crate exposes the additional assert_annotated_snapshot macro. This can be used with insta to render and compare snapshots of annotated data with meta data.

Re-exports§

pub use self::condition::RuleCondition;

Modules§

condition
Types to specify conditions on data.

Macros§

assert_annotated_snapshot
Asserts the snapshot of an annotated structure using insta.
derive_string_meta_structure
Derives the FromValue, IntoValue, and Empty traits using the string representation.
get_path
Returns a reference to the typed Annotated value at a given path.
get_value
Returns a reference to the typed value at a given path in an Annotated.

Structs§

Annotated
Wrapper for data fields with optional meta data.
Arr
Borrowed version of Array.
DeserializableAnnotated
An utility to de-serialize annotated objects with payload.
Error
An error with an enumerable kind and optional data.
GetterIter
A type-erased iterator over a collection of Getters.
Meta
Meta information for a data field in the event payload.
MetaTree
Represents a tree of meta objects.
Obj
Borrowed version of Object.
Remark
Information on a modified section in a string.
SerializableAnnotated
An utility to serialize annotated objects with payload.
ValueDescription
Helper type that renders out a description of the value.

Enums§

ErrorKind
The kind of an Error.
RemarkType
Gives an indication about the type of remark.
SkipSerialization
Defines behavior for skipping the serialization of fields.
Val
Borrowed version of Value.
Value
Represents a boxed value.

Traits§

Empty
A value that can be empty.
FromObjectRef
Implemented for all meta structures which can be created from an object.
FromValue
Implemented for all meta structures.
Getter
A type that supports field access by paths.
IntoObjectRef
Implemented for all meta structures which can be serialized into an object.
IntoValue
Implemented for all meta structures.

Functions§

estimate_size
Estimates the size in bytes this would be in JSON.
estimate_size_flat
Estimates the size in bytes this would be in JSON, but does not recurse into objects or arrays.
to_value
Convert T into a Value.

Type Aliases§

Array
Alias for typed arrays.
Map
Alias for maps.
MetaMap
Meta for children.
Object
Alias for typed objects.
Range
The start (inclusive) and end (exclusive) indices of a Remark.

Derive Macros§

Empty
FromValue
IntoValue