Skip to main content

parse_dependency_string

Function parse_dependency_string 

Source
pub fn parse_dependency_string(
    dep_str: &str,
    is_known_manager: impl Fn(&str) -> bool,
) -> Result<Dependency<'_>, Error>
Expand description

Parses a dependency string into its constituent parts.

The expected format is manager:package[@version][:description]. If the manager is omitted, it defaults to “zoi”.

Arguments:

  • dep_str: The raw dependency string from a package definition.
  • is_known_manager: A closure that determines if a prefix should be treated as a manager name.

§Errors

Returns an error if the dependency string is invalid, the package name is missing, or if the version requirement is malformed for the “zoi” manager.