Skip to main content Crate serde_saphyr Copy item path Source pub use self::ser::error as ser_error;pub use self::ser::options::SerializerOptions ;pub use ser::YamlSerializer as Serializer;budget Streaming YAML budget checker using saphyr-parser. localizer Localization / wording customization. options 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. 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. 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 . Budget Budgets for a streaming YAML scan. Commented Attach an inline YAML comment to a value when serializing. CroppedRegion Cropped YAML source window stored inside Error::WithSnippet . DefaultEnglishLocalizer Default English localizer used by the crate. DefaultMessageFormatter Default developer-oriented message formatter. Deserializer The streaming Serde deserializer. ExternalMessage A best-effort description of an external message. FlowMap Force a mapping to be emitted in flow style: {k1: v1, k2: v2}. FlowSeq Force a sequence to be emitted in flow style: [a, b, c]. 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. IncludeRequest A request passed to the include resolver to resolve an include directive. 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. Options Parser configuration options. 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. ResolvedInclude A resolved include containing the source identity and the content. SpaceAfter Add an empty line after the wrapped value when serializing. 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. DuplicateKeyPolicy Duplicate key handling policy for mappings. Error Error type compatible with serde::de::Error. ExternalMessageSource Where an “external” message comes from. IncludeResolveError Error type returned by user-provided include resolvers. InputSource Owned input that can be fed into the YAML parser. RequireIndent Requirements for indentation validation during YAML deserialization. ResolveProblem Specific problems encountered during file include resolution. SnippetMode Controls whether snippet output is included when available. TransformReason The reason why a string value was transformed during parsing and cannot be borrowed. DEFAULT_ENGLISH_LOCALIZER A single shared instance of the default English localizer. Localizer All crate-authored wording customization points. MessageFormatter Formats error messages (not including locations/snippets). 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_with_options Deserialize multiple YAML documents into a vector with configurable Options . from_reader Deserialize a single YAML document from any std::io::Read. from_reader_with_options Deserialize a single YAML document from any std::io::Read with configurable Options. 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_with_options Deserialize a single YAML document from a UTF-8 byte slice with configurable Options . from_str Deserialize any T: serde::de::Deserialize<'de> directly from a YAML string. from_str_with_options Deserialize a single YAML document with configurable Options . read Create an iterator over YAML documents from any std::io::Read using default options. read_with_options Create an iterator over YAML documents from any std::io::Read, with configurable options. 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_multiple_with_options Serialize multiple documents into a YAML string with configurable Options. to_string_with_options Serialize a value to a YAML String, with SerializerOptions . to_writer Deprecated Deprecated: use to_fmt_writer or to_io_writer
Kept for a transition release to avoid instant breakage. to_writer_with_options Deprecated 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. DeveloperMessageFormatter Alias for the default developer-oriented formatter. IncludeResolver Callback used to resolve !include directives during parsing.