Skip to main content

Version

Trait Version 

Source
pub trait Version: Send + Sync {
    // Required methods
    fn version_string(&self) -> &ConcreteVersion;
    fn as_any(&self) -> &dyn Any;

    // Provided methods
    fn removal_status(&self) -> RemovalStatus { ... }
    fn deprecation(&self) -> Option<&Deprecation> { ... }
    fn is_prerelease(&self) -> bool { ... }
    fn features(&self) -> Vec<String> { ... }
    fn is_stable(&self) -> bool { ... }
    fn published_at(&self) -> Option<PublishTime> { ... }
}
Expand description

Version information trait.

All version types must implement this to work with generic handlers.

Required Methods§

Source

fn version_string(&self) -> &ConcreteVersion

Version string (e.g., “1.0.214”, “14.21.3”).

Source

fn as_any(&self) -> &dyn Any

Downcast to concrete version type

Provided Methods§

Source

fn removal_status(&self) -> RemovalStatus

This version’s removal/deprecation status as reported by the registry.

Default: RemovalStatus::Available — ecosystems with no yank/deprecation signal need no override.

Source

fn deprecation(&self) -> Option<&Deprecation>

Package-level deprecation payload, when this version’s registry data carries one.

Default None — the Option is the capability gate: an ecosystem that never overrides this produces no deprecation diagnostic/hover/quickfix at all, rather than depending on a separate “does this ecosystem report deprecation” predicate.

Source

fn is_prerelease(&self) -> bool

Whether this version is a pre-release (alpha, beta, rc, etc.).

Default implementation checks for common pre-release patterns via has_default_prerelease_marker.

Source

fn features(&self) -> Vec<String>

Available feature flags (empty if not supported by ecosystem).

Source

fn is_stable(&self) -> bool

Whether this version is stable: not hard-yanked and not a pre-release.

An AdvisoryDeprecated version counts as stable here — it remains fully resolvable, just flagged. Only Yanked disqualifies a version; see RemovalStatus::blocks_resolution.

Source

fn published_at(&self) -> Option<PublishTime>

When this version was published, if the registry exposes it.

Default None — ecosystems without publish metadata (or where fetching it would add a network round trip) degrade to pre-feature behavior: no freshness signal shown, no error, no change in ranking.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§