Skip to main content

Index

Struct Index 

Source
pub struct Index {
    pub repository: RepositoryInfo,
    pub objects: Vec<Object>,
    pub diagnostics: Vec<Diagnostic>,
    pub state: State,
    pub fingerprint: String,
    pub scoped: Scoped,
    pub distribution: Option<Model>,
    pub providers: ProviderDeclarations,
    pub share: Option<PathBuf>,
}
Expand description

The objects of the repository, their diagnostics, and the repository they came from.

Fields§

§repository: RepositoryInfo

The repository the index was built from.

§objects: Vec<Object>

Sorted by URI; unique by URI.

§diagnostics: Vec<Diagnostic>

Every finding, in discovery order.

§state: State

Ok, or degraded when a diagnostic is an error.

§fingerprint: String

A hash of every object’s path and content, in URI order: the repository state this index is a picture of, stable across processes.

§scoped: Scoped

The scope the index was built under, with every tracked file tallied against it.

§distribution: Option<Model>

The distribution model the tool was run with, when it carries one: how this project is packaged, published and installed. Read from the tool’s data directory beside the kinds and the schemas, not discovered in the repository, so that an installed copy answers the same questions a checkout does.

§providers: ProviderDeclarations

The providers the tool distribution ships an adapter for: one per template under share/providers/, joined with what share/providers.yaml declares about it. Read from the tool’s data directory beside the kinds and the schemas, like the distribution model, so that the product model can say which providers exist without a second discovery.

§share: Option<PathBuf>

The distribution directory this process located, absolute, when one was located.

The share is a fact about the invocation, not about the repository: it is what --share, MAJORDOMUS_SHARE, the repository or the installation resolved to, and crate::app::App records it here so that a handler needing a file beside the kinds — the obligation vocabulary, the shell tool’s command registry — reads the distribution this process was run with instead of resolving one of its own. A handler that resolved its own would answer from a different distribution than the one whose kinds it was configured with, and, for an executable that lives outside the repository, from none at all. None for an index built directly, which is what makes the resolution fall back to the conventions.

Implementations§

Source§

impl Index

Source

pub fn build( repo: &Repository, sources: &Sources, schema: &KindSchema, source: &dyn DiscoverySource, git: GitState, scope: Scope, ) -> Result<Self, Error>

Discover, read, validate. source decides how files are enumerated; git is whatever git::inspect said and is carried, never consulted here.

Source

pub fn get(&self, uri: &str) -> Option<&Object>

An object by URI.

Source

pub fn errors(&self) -> usize

How many diagnostics are errors.

Source

pub fn kinds(&self) -> BTreeMap<&str, usize>

The kinds present, with how many objects each has.

Trait Implementations§

Source§

impl Debug for Index

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Index

§

impl RefUnwindSafe for Index

§

impl Send for Index

§

impl Sync for Index

§

impl Unpin for Index

§

impl UnsafeUnpin for Index

§

impl UnwindSafe for Index

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
§

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

§

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.

§

impl<T> Instrument for T

§

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

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

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.

§

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<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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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