pub struct LoadOptions { /* private fields */ }Expand description
Options for loading YAML into constructed trees or Serde values.
Implementations§
Source§impl LoadOptions
impl LoadOptions
Sourcepub const fn core() -> Self
pub const fn core() -> Self
Creates load options using explicit YAML 1.2 Core-compatible construction.
Sourcepub const fn yaml_1_1() -> Self
pub const fn yaml_1_1() -> Self
Creates load options using explicit YAML 1.1 compatibility construction.
Sourcepub const fn legacy_serde_yaml() -> Self
pub const fn legacy_serde_yaml() -> Self
Creates load options using legacy libyaml/serde_yaml-era construction.
Sourcepub const fn yaml_version_directive() -> Self
pub const fn yaml_version_directive() -> Self
Creates load options that follow each document’s %YAML version directive.
%YAML 1.1 documents use YAML 1.1 compatibility construction. Documents
without a version directive, with %YAML 1.2, or with newer numeric
versions use the YAML 1.2-oriented default construction.
Sourcepub const fn schema(self, schema: Schema) -> Self
pub const fn schema(self, schema: Schema) -> Self
Returns options with the selected scalar construction schema.
Sourcepub const fn selected_schema(self) -> Schema
pub const fn selected_schema(self) -> Schema
Returns the selected scalar construction schema.
Sourcepub const fn max_input_bytes(self, max_input_bytes: usize) -> Self
pub const fn max_input_bytes(self, max_input_bytes: usize) -> Self
Returns options with a maximum input size in bytes.
Sourcepub const fn without_input_limit(self) -> Self
pub const fn without_input_limit(self) -> Self
Returns options without an input size limit.
Sourcepub const fn selected_max_input_bytes(self) -> Option<usize>
pub const fn selected_max_input_bytes(self) -> Option<usize>
Returns the configured maximum input size in bytes.
Sourcepub const fn max_alias_expansion_nodes(
self,
max_alias_expansion_nodes: usize,
) -> Self
pub const fn max_alias_expansion_nodes( self, max_alias_expansion_nodes: usize, ) -> Self
Returns options with a maximum number of alias-expanded nodes.
The default budget remains input-size derived. This option lets callers loading untrusted configuration tighten that expansion work directly.
Sourcepub const fn selected_max_alias_expansion_nodes(self) -> Option<usize>
pub const fn selected_max_alias_expansion_nodes(self) -> Option<usize>
Returns the configured maximum number of alias-expanded nodes.
None means the default input-size-derived budget is selected.
Sourcepub const fn max_nesting_depth(self, max_nesting_depth: usize) -> Self
pub const fn max_nesting_depth(self, max_nesting_depth: usize) -> Self
Returns options with a maximum constructed YAML nesting depth.
Sourcepub const fn without_nesting_depth_limit(self) -> Self
pub const fn without_nesting_depth_limit(self) -> Self
Returns options without a constructed nesting-depth limit.
Disabling the nesting-depth limit also removes protection against stack overflow: adversarially deep alias chains or nested flow collections can recurse until the thread’s stack is exhausted and the process aborts. Only disable the limit for trusted input.
Sourcepub const fn selected_max_nesting_depth(self) -> Option<usize>
pub const fn selected_max_nesting_depth(self) -> Option<usize>
Returns the configured maximum constructed nesting depth.
Sourcepub const fn max_scalar_bytes(self, max_scalar_bytes: usize) -> Self
pub const fn max_scalar_bytes(self, max_scalar_bytes: usize) -> Self
Returns options with a maximum resolved scalar size in bytes.
Sourcepub const fn without_scalar_limit(self) -> Self
pub const fn without_scalar_limit(self) -> Self
Returns options without a resolved scalar-size limit.
Sourcepub const fn selected_max_scalar_bytes(self) -> Option<usize>
pub const fn selected_max_scalar_bytes(self) -> Option<usize>
Returns the configured maximum resolved scalar size in bytes.
Sourcepub const fn max_collection_items(self, max_collection_items: usize) -> Self
pub const fn max_collection_items(self, max_collection_items: usize) -> Self
Returns options with a maximum number of entries per sequence or mapping.
Sourcepub const fn without_collection_limit(self) -> Self
pub const fn without_collection_limit(self) -> Self
Returns options without a per-collection item limit.
Sourcepub const fn selected_max_collection_items(self) -> Option<usize>
pub const fn selected_max_collection_items(self) -> Option<usize>
Returns the configured maximum number of entries per sequence or mapping.
Sourcepub fn parse_bytes(self, input: &[u8]) -> Result<Node>
pub fn parse_bytes(self, input: &[u8]) -> Result<Node>
Parses a single UTF-8 YAML document from bytes using these options.
Sourcepub fn parse_str(self, input: &str) -> Result<Node>
pub fn parse_str(self, input: &str) -> Result<Node>
Parses a single YAML document from a string using these options.
Sourcepub fn parse_documents(self, input: &str) -> Result<Vec<Node>>
pub fn parse_documents(self, input: &str) -> Result<Vec<Node>>
Parses all documents in a YAML stream using these options.
Sourcepub fn parse_borrowed_documents<'de>(
self,
input: &'de str,
) -> Result<Vec<BorrowedNode<'de>>>
pub fn parse_borrowed_documents<'de>( self, input: &'de str, ) -> Result<Vec<BorrowedNode<'de>>>
Parses all documents into spanless trees that can borrow scalar strings from input.
Sourcepub fn stream_events(self, input: &str) -> Result<EventStream>
pub fn stream_events(self, input: &str) -> Result<EventStream>
Creates a pull-based raw event stream using these options.
Sourcepub fn stream_events_slice(self, input: &[u8]) -> Result<EventStream>
pub fn stream_events_slice(self, input: &[u8]) -> Result<EventStream>
Creates a pull-based raw event stream from UTF-8 bytes using these options.
Sourcepub fn stream_events_reader<R>(self, reader: R) -> Result<EventStream>where
R: Read,
pub fn stream_events_reader<R>(self, reader: R) -> Result<EventStream>where
R: Read,
Reads YAML bytes and creates a pull-based raw event stream using these options.
Sourcepub fn stream_documents(self, input: &str) -> Result<DocumentStream>
pub fn stream_documents(self, input: &str) -> Result<DocumentStream>
Creates a pull-based parsed document stream using these options.
Sourcepub fn stream_documents_slice(self, input: &[u8]) -> Result<DocumentStream>
pub fn stream_documents_slice(self, input: &[u8]) -> Result<DocumentStream>
Creates a pull-based parsed document stream from UTF-8 bytes using these options.
Sourcepub fn stream_documents_reader<R>(self, reader: R) -> Result<DocumentStream>where
R: Read,
pub fn stream_documents_reader<R>(self, reader: R) -> Result<DocumentStream>where
R: Read,
Reads YAML bytes and creates a pull-based parsed document stream using these options.
Sourcepub fn from_str<'de, T>(self, input: &'de str) -> Result<T>where
T: Deserialize<'de>,
pub fn from_str<'de, T>(self, input: &'de str) -> Result<T>where
T: Deserialize<'de>,
Deserializes a single YAML document from a string using these options.
Sourcepub fn from_slice<'de, T>(self, input: &'de [u8]) -> Result<T>where
T: Deserialize<'de>,
pub fn from_slice<'de, T>(self, input: &'de [u8]) -> Result<T>where
T: Deserialize<'de>,
Deserializes a single UTF-8 YAML document from bytes using these options.
Sourcepub fn from_reader<R, T>(self, reader: R) -> Result<T>where
R: Read,
T: DeserializeOwned,
pub fn from_reader<R, T>(self, reader: R) -> Result<T>where
R: Read,
T: DeserializeOwned,
Reads all bytes from a reader and deserializes one YAML document.
Sourcepub fn from_documents_str<T>(self, input: &str) -> Result<Vec<T>>where
T: DeserializeOwned,
pub fn from_documents_str<T>(self, input: &str) -> Result<Vec<T>>where
T: DeserializeOwned,
Deserializes every document in a YAML stream from a string.
Sourcepub fn from_documents_slice<T>(self, input: &[u8]) -> Result<Vec<T>>where
T: DeserializeOwned,
pub fn from_documents_slice<T>(self, input: &[u8]) -> Result<Vec<T>>where
T: DeserializeOwned,
Deserializes every document in a UTF-8 YAML stream from bytes.
Sourcepub fn from_documents_reader<T, R>(self, reader: R) -> Result<Vec<T>>where
T: DeserializeOwned,
R: Read,
pub fn from_documents_reader<T, R>(self, reader: R) -> Result<Vec<T>>where
T: DeserializeOwned,
R: Read,
Reads all bytes from a reader and deserializes every YAML document.
Sourcepub fn deserializer_from_str<'de>(self, input: &'de str) -> Deserializer<'de> ⓘ
pub fn deserializer_from_str<'de>(self, input: &'de str) -> Deserializer<'de> ⓘ
Creates a streaming Serde deserializer from a YAML string.
Sourcepub fn deserializer_from_slice<'de>(self, input: &'de [u8]) -> Deserializer<'de> ⓘ
pub fn deserializer_from_slice<'de>(self, input: &'de [u8]) -> Deserializer<'de> ⓘ
Creates a streaming Serde deserializer from UTF-8 YAML bytes.
Sourcepub fn deserializer_from_reader<R>(self, reader: R) -> Deserializer<'static> ⓘwhere
R: Read,
pub fn deserializer_from_reader<R>(self, reader: R) -> Deserializer<'static> ⓘwhere
R: Read,
Reads a YAML stream and creates a streaming Serde deserializer.
Trait Implementations§
Source§impl Clone for LoadOptions
impl Clone for LoadOptions
Source§fn clone(&self) -> LoadOptions
fn clone(&self) -> LoadOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LoadOptions
Source§impl Debug for LoadOptions
impl Debug for LoadOptions
Source§impl Default for LoadOptions
impl Default for LoadOptions
impl Eq for LoadOptions
Source§impl PartialEq for LoadOptions
impl PartialEq for LoadOptions
Source§fn eq(&self, other: &LoadOptions) -> bool
fn eq(&self, other: &LoadOptions) -> bool
self and other values to be equal, and is used by ==.