pub struct VersionParser;Expand description
Version parser for Composer semver.
Implementations§
Source§impl VersionParser
impl VersionParser
Sourcepub fn parse_stability(version: &str) -> Stability
pub fn parse_stability(version: &str) -> Stability
Parse and return the stability of a version string.
Sourcepub fn normalize_stability(stability: &str) -> Result<String>
pub fn normalize_stability(stability: &str) -> Result<String>
Normalize a stability string.
§Errors
Returns SemverError::InvalidStability if the string is not a valid stability.
Sourcepub fn normalize(version: &str) -> Result<String>
pub fn normalize(version: &str) -> Result<String>
Normalize a version string to Composer’s canonical form.
§Errors
Returns an error if the version string is not a valid version format.
Sourcepub fn normalize_full(
version: &str,
full_version: Option<&str>,
) -> Result<String>
pub fn normalize_full( version: &str, full_version: Option<&str>, ) -> Result<String>
Normalize a version string with optional full version context for error messages.
§Errors
Returns an error if the version string is not a valid version format.
Sourcepub fn normalize_branch(name: &str) -> String
pub fn normalize_branch(name: &str) -> String
Normalize a branch name.
Sourcepub fn normalize_default_branch(name: &str) -> String
👎Deprecated: No longer needed in Composer 2, which doesn’t normalize branch names to 9999999-dev
pub fn normalize_default_branch(name: &str) -> String
Normalize a default branch name (master, trunk, default) to 9999999-dev.
This is deprecated in Composer 2 but still needed for sorting versions.
Sourcepub fn parse_numeric_alias_prefix(branch: &str) -> Option<String>
pub fn parse_numeric_alias_prefix(branch: &str) -> Option<String>
Extract numeric alias prefix from a branch name.
Sourcepub fn parse_constraints(constraints: &str) -> Result<Box<dyn Constraint>>
pub fn parse_constraints(constraints: &str) -> Result<Box<dyn Constraint>>
Parse version constraints string into a Constraint.
§Errors
Returns an error if the constraint string is empty or malformed.
Trait Implementations§
Source§impl Clone for VersionParser
impl Clone for VersionParser
Source§fn clone(&self) -> VersionParser
fn clone(&self) -> VersionParser
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more