Skip to main content

parse_lockfile_str

Function parse_lockfile_str 

Source
pub fn parse_lockfile_str(
    path: PathBuf,
    content: &str,
) -> Result<LockfileModel, RustinelError>
Expand description

Parse a Cargo.lock from an in-memory string.

Backed by the upstream cargo_lock crate so the full lockfile grammar (v1–v4, git/path/registry sources, alternate registries) is handled correctly. We map its model into our own LockfileModel so the rest of the analysis is decoupled from the parser implementation. The top-level version = N field is read separately because it is the lockfile’s format version, which we surface verbatim. Parsing is panic-guarded (see [parse_cargo_lock]) because the input is untrusted.