Skip to main content

SemanticVersioningEngine

Struct SemanticVersioningEngine 

Source
pub struct SemanticVersioningEngine {
    pub artifacts: HashMap<String, VersionedArtifact>,
    pub compatibility_rules: CompatibilityMatrix,
}
Expand description

Manages versioned artifacts with SemVer-based change detection, compatibility analysis, and migration-path computation.

Fields§

§artifacts: HashMap<String, VersionedArtifact>

Registered artifacts keyed by their ID.

§compatibility_rules: CompatibilityMatrix

Rules governing cross-version compatibility.

Implementations§

Source§

impl SemanticVersioningEngine

Source

pub fn new() -> Self

Create a new engine with sensible default compatibility rules:

Rules are pre-populated for majors 0..=9.

Source

pub fn register_artifact( &mut self, artifact: VersionedArtifact, ) -> Result<(), SemVerError>

Register a new artifact.

Returns SemVerError::ArtifactAlreadyExists if an artifact with the same ID is already registered.

Source

pub fn publish_change( &mut self, artifact_id: &str, change_type: ChangeType, description: String, now: u64, ) -> Result<SemVer, SemVerError>

Apply a change to an artifact, auto-bumping its version according to ChangeType::required_bump, appending a ChangeRecord, and returning the new version.

Returns SemVerError::ArtifactNotFound when artifact_id is unknown.

Source

pub fn get_version(&self, artifact_id: &str) -> Option<&SemVer>

Return the current version of an artifact, or None if not found.

Source

pub fn version_history(&self, artifact_id: &str) -> Vec<&ChangeRecord>

Return all changelog entries for an artifact in registration order.

Source

pub fn check_compatibility( &self, from_id: &str, to_id: &str, ) -> Result<CompatibilityLevel, SemVerError>

Determine the compatibility level between the current versions of two artifacts.

Returns errors when either artifact ID is unknown.

Source

pub fn find_breaking_changes( &self, artifact_id: &str, since: &SemVer, ) -> Vec<&ChangeRecord>

Return all changelog entries with ChangeType::Breaking whose version is strictly greater than since.

Source

pub fn migration_path(&self, from: &SemVer, to: &SemVer) -> Vec<SemVer>

Compute a migration path between two SemVer values.

Rules:

  • Same version → [from]
  • Same major, different minor → [from, intermediate, to] where intermediate is (from.major, to.minor, 0) (i.e. from’s major with to’s minor bumped in).
  • Adjacent major (|delta| == 1) → [from, to]
  • Otherwise → [] (incompatible gap, no path)
Source

pub fn artifacts_at_version(&self, version: &SemVer) -> Vec<&str>

Return the IDs of all artifacts whose current version equals version.

Source

pub fn stats(&self) -> VersioningStats

Compute aggregate statistics over all registered artifacts.

Trait Implementations§

Source§

impl Default for SemanticVersioningEngine

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more