Skip to main content

Crate serde_saphyr

Crate serde_saphyr 

Source
Expand description

Serialization public API is defined at crate root

Re-exports§

pub use de::Budget;
pub use de::DuplicateKeyPolicy;
pub use de::Options;
pub use localizer::DefaultEnglishLocalizer;
pub use localizer::ExternalMessage;
pub use localizer::ExternalMessageSource;
pub use localizer::Localizer;
pub use localizer::DEFAULT_ENGLISH_LOCALIZER;
pub use ser::Commented;
pub use ser::FlowMap;
pub use ser::FlowSeq;
pub use ser::SpaceAfter;
pub use ser::YamlSerializer as Serializer;

Modules§

budget
Streaming YAML budget checker using saphyr-parser.
figment
localizer
Localization / wording customization.
miette
miette integration.
options
path_map
This module records YAML key paths (as seen during deserialization) and later tries to map validation paths back to those YAML locations.
robotics
ser
Single-pass YAML serializer with optional anchors for Rc/Arc/Weak, order preservation (uses the iterator order of your types), simple style controls (block strings & flow containers), and special float handling for NaN/±Inf. No intermediate YAML DOM is built.
ser_error

Macros§

budget
Construct Some([crate::Budget]) from Default and a list of field assignments.
options
Construct crate::Options from Default and a list of field assignments.
render_options
Construct crate::RenderOptions from defaults and a list of field assignments.
ser_options
Construct crate::SerializerOptions from Default and a list of field assignments.

Structs§

ArcAnchor
A wrapper around Arc<T> that opt-ins a field for anchor emission (e.g. serialization by reference).
ArcRecursion
The possibly recursive reference to the parent anchor that must be ArcRecursive, thread safe It is more complex to use than RcRecursive (you need to lock it before accessing the value) See ArcRecursive for code example.
ArcRecursive
The parent (origin) anchor definition that may have recursive references to it. This type provides the value for the references and must be placed where the original value is defined. Fields that reference this value (possibly recursively) must be wrapped in ArcRecursion.
ArcWeakAnchor
A wrapper around [Weak<T>] (from std::sync) that opt-ins for anchor emission.
CroppedRegion
Cropped YAML source window stored inside Error::WithSnippet.
DefaultMessageFormatter
Default developer-oriented message formatter.
Deserializer
The streaming Serde deserializer.
FoldStr
Force a YAML folded block string using the > style.
FoldString
Owned-string variant of FoldStr that forces a YAML folded block string using the > style.
LitStr
Force a YAML block literal string using the | style.
LitString
Owned-string variant of LitStr that forces a YAML block literal string using the | style.
Location
Row/column location within the source YAML document (1-indexed, character-based).
Locations
Pair of locations for values that may come indirectly from YAML anchors.
RcAnchor
A wrapper around Rc<T> that opt-ins a field for anchor emission (e.g. serialization by reference).
RcRecursion
The possibly recursive reference to the parent anchor that must be RcRecursive. See RcRecursive for code example.
RcRecursive
The parent (origin) anchor definition that may have recursive references to it. This type provides the value for the references and must be placed where the original value is defined. Fields that reference this value (possibly recursively) must be wrapped in RcRecursion.
RcWeakAnchor
A wrapper around [Weak<T>] (from std::rc) that opt-ins for anchor emission.
RenderOptions
Options for deferred error rendering.
SerializerOptions
Serializer options for YAML emission.
Span
A span within the source YAML document.
Spanned
A value paired with source locations describing where it came from. Spanned location is specified in character positions and, when possible, in byte offsets as well (byte offsets are available for a string source but not from the reader.
UserMessageFormatter
User-facing message formatter.

Enums§

Error
Error type compatible with serde::de::Error.
SnippetMode
Controls whether snippet output is included when available.
TransformReason
The reason why a string value was transformed during parsing and cannot be borrowed.

Traits§

MessageFormatter
Formats error messages (not including locations/snippets).

Functions§

from_multiple
Deserialize multiple YAML documents from a single string into a vector of T. Completely empty documents are ignored and not included into returned vector.
from_multiple_valid
Deserialize multiple YAML documents from a YAML string and validate each with garde. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_multiple_validate
Deserialize multiple YAML documents from a YAML string and validate each with validator. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_multiple_with_options
Deserialize multiple YAML documents into a vector with configurable Options.
from_multiple_with_options_valid
Deserialize multiple YAML documents with configurable Options and validate each with garde. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_multiple_with_options_validate
Deserialize multiple YAML documents with configurable Options and validate each with validator. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_reader
Deserialize a single YAML document from any std::io::Read.
from_reader_valid
Deserialize a single YAML document from a reader and validate it with garde. As there is no access to the full text of the document, the error message will not contain a snippet.
from_reader_validate
Deserialize a single YAML document from a reader and validate it with validator. As there is no access to the full text of the document, the error message will not contain a snippet.
from_reader_with_options
Deserialize a single YAML document from any std::io::Read with configurable Options.
from_reader_with_options_valid
Deserialize a single YAML document from a reader with options and validate it with garde. As there is no access to the full text of the document, the error message will not contain a snippet.
from_reader_with_options_validate
Deserialize a single YAML document from a reader with options and validate it with validator. As there is no access to the full text of the document, the error message will not contain a snippet.
from_slice
Deserialize a single YAML document from a UTF-8 byte slice.
from_slice_multiple
Deserialize multiple YAML documents from a UTF-8 byte slice into a vector of T.
from_slice_multiple_with_options
Deserialize multiple YAML documents from bytes with configurable Options. Completely empty documents are ignored and not included into returned vector.
from_slice_multiple_with_options_valid
Deserialize multiple YAML documents from bytes with options and validate each with garde. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_slice_multiple_with_options_validate
Deserialize multiple YAML documents from bytes with options and validate each with validator. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_slice_valid
Deserialize a single YAML document from bytes and validate it with garde. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_slice_validate
Deserialize a single YAML document from bytes and validate it with validator. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_slice_with_options
Deserialize a single YAML document from a UTF-8 byte slice with configurable Options.
from_slice_with_options_valid
Deserialize a single YAML document from bytes and validate it with garde. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_slice_with_options_validate
Deserialize a single YAML document from bytes and validate it with validator. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_str
Deserialize any T: serde::de::Deserialize<'de> directly from a YAML string.
from_str_valid
Deserialize a single YAML document from a YAML string and validate it with garde. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_str_validate
Deserialize a single YAML document from a YAML string and validate it with validator. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_str_with_options
Deserialize a single YAML document with configurable Options.
from_str_with_options_context_valid
Deserialize a single YAML document with configurable Options and validate it with garde in context [<T as garde::Validate>::Context]. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_str_with_options_valid
Deserialize a single YAML document with configurable Options and validate it with garde. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
from_str_with_options_validate
Deserialize a single YAML document with configurable Options and validate it with validator. The error message will contain a snippet with exact location information, and if the invalid value comes from anchor, serde-saphyr will also tell where it is defined.
read
Create an iterator over YAML documents from any std::io::Read using default options.
read_valid
Create an iterator over validated YAML documents from a reader. As there is no access to the full text of the document, the error message will not contain a snippet.
read_validate
Create an iterator over validated YAML documents from a reader. As there is no access to the full text of the document, the error message will not contain a snippet.
read_with_options
Create an iterator over YAML documents from any std::io::Read, with configurable options.
read_with_options_valid
Create an iterator over validated YAML documents from a reader with configurable options. As there is no access to the full text of the document, the error message will not contain a snippet.
read_with_options_validate
Create an iterator over validated YAML documents from a reader with configurable options. As there is no access to the full text of the document, the error message will not contain a snippet.
to_fmt_writer
Serialize a value as YAML into any [fmt::Write] target.
to_fmt_writer_with_options
Serialize a value as YAML into any [fmt::Write] target, with options. Options are consumed because anchor generator may be taken from them.
to_io_writer
Serialize a value as YAML into any [io::Write] target.
to_io_writer_with_options
Serialize a value as YAML into any [io::Write] target, with options. Options are consumed because anchor generator may be taken from them.
to_string
Serialize a value to a YAML String.
to_string_multiple
Serialize multiple documents into a YAML string.
to_string_with_options
Serialize a value to a YAML String, with SerializerOptions.
to_writerDeprecated
Deprecated: use to_fmt_writer or to_io_writer Kept for a transition release to avoid instant breakage.
to_writer_with_optionsDeprecated
Deprecated: use to_fmt_writer_with_options for fmt::Write or to_io_writer_with_options for io::Write.
with_deserializer_from_reader
Create a streaming crate::Deserializer for any std::io::Read and run a closure against it.
with_deserializer_from_reader_with_options
Create a streaming crate::Deserializer for any std::io::Read with configurable Options and run a closure against it.
with_deserializer_from_slice
Create a streaming crate::Deserializer for a UTF-8 byte slice and run a closure against it.
with_deserializer_from_slice_with_options
Create a streaming crate::Deserializer for a UTF-8 byte slice with configurable Options and run a closure against it.
with_deserializer_from_str
Convenience wrapper around with_deserializer_from_str_with_options using Options::default.
with_deserializer_from_str_with_options
Create a streaming crate::Deserializer for a YAML string and run a closure against it.

Type Aliases§

DeveloperMessageFormatter
Alias for the default developer-oriented formatter.