VersionValidator

Struct VersionValidator 

Source
pub struct VersionValidator { /* private fields */ }
Available on crate feature doc-audit only.
Expand description

Version validator that checks consistency between documentation and workspace.

Implementations§

Source§

impl VersionValidator

Source

pub async fn new(workspace_path: &Path) -> Result<VersionValidator, AuditError>

Creates a new version validator for the given workspace.

§Arguments
  • workspace_path - Path to the workspace root directory
§Returns

A new VersionValidator instance or an error if workspace analysis fails.

Source

pub fn with_workspace_info( workspace_info: WorkspaceVersionInfo, ) -> Result<VersionValidator, AuditError>

Creates a version validator with custom workspace information.

This is useful for testing or when workspace information is already available.

Source

pub fn validate_version_reference( &self, version_ref: &VersionReference, config: &VersionValidationConfig, ) -> Result<VersionValidationResult, AuditError>

Validates a version reference against workspace information.

§Arguments
  • version_ref - The version reference to validate
  • config - Validation configuration options
§Returns

A VersionValidationResult indicating whether the reference is valid.

Source

pub fn validate_version_references( &self, version_refs: &[VersionReference], config: &VersionValidationConfig, ) -> Result<Vec<VersionValidationResult>, AuditError>

Validates multiple version references in batch.

§Arguments
  • version_refs - Collection of version references to validate
  • config - Validation configuration options
§Returns

A vector of validation results corresponding to each input reference.

Source

pub fn validate_dependency_compatibility( &self, dependency_name: &str, documented_version: &str, config: &VersionValidationConfig, ) -> Result<VersionValidationResult, AuditError>

Validates dependency version compatibility across the workspace.

This method checks that all dependency versions used in documentation are compatible with the versions actually used in the workspace.

Source

pub fn is_version_compatible( &self, version1: &str, version2: &str, tolerance: &VersionTolerance, ) -> Result<bool, AuditError>

Checks if a version string represents a compatible version.

This method uses semantic versioning rules to determine compatibility.

Source

pub fn validate_crate_exists(&self, crate_name: &str) -> VersionValidationResult

Validates that mentioned crate names exist in the workspace.

§Arguments
  • crate_name - Name of the crate to validate
§Returns

A VersionValidationResult indicating whether the crate exists.

Source

pub fn validate_feature_flag( &self, crate_name: &str, feature_name: &str, ) -> VersionValidationResult

Validates that feature flags exist in the specified crate.

§Arguments
  • crate_name - Name of the crate that should define the feature
  • feature_name - Name of the feature flag to validate
§Returns

A VersionValidationResult indicating whether the feature exists.

Source

pub fn validate_crate_names( &self, crate_names: &[String], ) -> Vec<VersionValidationResult>

Validates multiple crate names in batch.

§Arguments
  • crate_names - Collection of crate names to validate
§Returns

A vector of validation results corresponding to each input crate name.

Source

pub fn validate_feature_mentions( &self, feature_mentions: &[FeatureMention], ) -> Vec<VersionValidationResult>

Validates feature flag references from documentation.

This method processes feature mentions extracted from documentation and validates them against the workspace feature definitions.

Source

pub fn validate_feature_in_any_crate( &self, feature_name: &str, ) -> VersionValidationResult

Validates that a feature exists in any workspace crate.

This is used when the crate name cannot be determined from context.

Source

pub fn get_workspace_crates(&self) -> Vec<String>

Gets all crate names in the workspace.

Source

pub fn get_crate_features(&self, crate_name: &str) -> Option<Vec<String>>

Gets all features defined in a specific crate.

Source

pub fn get_all_workspace_features(&self) -> HashMap<String, Vec<String>>

Gets all features defined across the workspace.

Source

pub fn suggest_correct_version( &self, version_ref: &VersionReference, ) -> Option<String>

Suggests the correct version for an invalid reference.

This method provides intelligent suggestions based on the type of version reference and available workspace information.

Trait Implementations§

Source§

impl Debug for VersionValidator

Source§

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

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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