VersionParser

Struct VersionParser 

Source
pub struct VersionParser;
Expand description

Version parser for Composer semver.

Implementations§

Source§

impl VersionParser

Source

pub fn parse_stability(version: &str) -> Stability

Parse and return the stability of a version string.

Source

pub fn normalize_stability(stability: &str) -> Result<String>

Normalize a stability string.

§Errors

Returns SemverError::InvalidStability if the string is not a valid stability.

Source

pub fn is_valid(version: &str) -> bool

Check if a version string is valid.

Source

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.

Source

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.

Source

pub fn normalize_branch(name: &str) -> String

Normalize a branch name.

Source

pub fn normalize_default_branch(name: &str) -> String

👎Deprecated: No longer needed in Composer 2, which doesn’t normalize branch names to 9999999-dev

Normalize a default branch name (master, trunk, default) to 9999999-dev.

This is deprecated in Composer 2 but still needed for sorting versions.

Source

pub fn parse_numeric_alias_prefix(branch: &str) -> Option<String>

Extract numeric alias prefix from a branch name.

Source

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

Source§

fn clone(&self) -> VersionParser

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VersionParser

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VersionParser

Source§

fn default() -> VersionParser

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.