Skip to main content

Module parser

Module parser 

Source
Expand description

Shared manifest-parsing helpers: bounded JSON/TOML/YAML nesting checks and depth-limited parsing used by every ecosystem’s manifest parser.

Enums§

CheckedTomlError
Error returned by parse_toml_checked: either content nests deeper than MAX_TOML_NESTING_DEPTH or toml-span itself rejects it as invalid syntax.
DependencySource
Dependency source location (shared across all ecosystems).
LoadingState
Loading state for registry data fetching.

Constants§

MAX_JSON_NESTING_DEPTH
Maximum allowed nesting depth for JSON array/object recursion before check_json_nesting_depth rejects the input.
MAX_TOML_NESTING_DEPTH
Maximum allowed nesting depth for TOML table/array recursion before check_toml_nesting_depth rejects the input.
MAX_YAML_EXPANDED_BYTES
Maximum total byte weight check_yaml_expansion allows a document to expand to (counting anchor/alias-driven duplication) before rejecting it.
MAX_YAML_NESTING_DEPTH
Maximum allowed nesting depth for YAML block/flow recursion before check_yaml_nesting_depth rejects the input.

Functions§

check_json_nesting_depth
Scans raw JSON bytes for [/{ nesting deeper than max_depth, before handing the bytes to serde_json::from_slice/from_str.
check_toml_nesting_depth
Scans raw TOML text for table/array recursion deeper than max_depth.
check_yaml_bounds
Runs check_yaml_nesting_depth and check_yaml_expansion against content, converting either rejection into a DepsError::ParseError labeled with file_type.
check_yaml_expansion
Streams content through yaml-rust2’s own parser event stream and tallies the total bytes the Yaml nodes YamlLoader::load_from_str would allocate, rejecting once the tally exceeds max_bytes.
check_yaml_nesting_depth
Scans raw YAML text for block/flow recursion deeper than max_depth.
json_depth_error_message
Message text for a JSON payload rejected for nesting deeper than MAX_JSON_NESTING_DEPTH.
looks_like_filesystem_path
Whether value looks like a local filesystem path reference in a manifest specifier.
parse_json_checked
Deserializes bytes into T, first rejecting payloads whose JSON nesting exceeds MAX_JSON_NESTING_DEPTH (see that constant’s doc for why).
parse_toml_checked
Parses content as TOML, first rejecting input whose nesting exceeds MAX_TOML_NESTING_DEPTH (see that constant’s doc for why).
yaml_scalar_string
Renders a scalar YAML node as a string regardless of whether it was quoted or bare.