Skip to main content

Metadata

Trait Metadata 

Source
pub trait Metadata: Send + Sync {
    // Required methods
    fn name(&self) -> &PackageName;
    fn description(&self) -> Option<&str>;
    fn repository(&self) -> Option<&str>;
    fn documentation(&self) -> Option<&str>;
    fn latest_version(&self) -> &ConcreteVersion;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Package metadata trait.

Used for completion items and hover documentation.

Required Methods§

Source

fn name(&self) -> &PackageName

The package name as the registry reports it.

This is the identifier the registry displays and that completion pastes into a manifest. It is not guaranteed byte-identical to the manifest-declared Dependency::name for the same package: casing may differ (NuGet, Composer, Swift), and for Maven/Gradle it is a "group:artifact" value synthesized from two separate response fields. Do not compare it to a manifest name without going through PackageNaming::normalize_package_name.

Source

fn description(&self) -> Option<&str>

Short description (optional).

Source

fn repository(&self) -> Option<&str>

Repository URL (optional).

Source

fn documentation(&self) -> Option<&str>

Documentation URL (optional).

Source

fn latest_version(&self) -> &ConcreteVersion

Latest stable version.

Source

fn as_any(&self) -> &dyn Any

Downcast to concrete metadata type

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§