pub struct CandidateVersion { /* private fields */ }Expand description
What:
The candidates of one listed state.
Fields are private:
a version is built
once by build_version and never changed.
Why:
Immutability is what lets several policies share one listing safely.
In TS you’d write (pseudocode):
class CandidateVersion { readonly #candidates: readonly Candidate[]; readonly #byPath: ReadonlyMap<string, number> }Implementations§
Source§impl CandidateVersion
What:
impl CandidateVersion { ... } attaches read-only accessors,
like class getters.
Why:
Callers can read a version and cannot change it.
impl CandidateVersion
What:
impl CandidateVersion { ... } attaches read-only accessors,
like class getters.
Why:
Callers can read a version and cannot change it.
In TS you’d write (pseudocode):
class CandidateVersion { get candidates() {} candidateAtPath(path) {} }Sourcepub fn candidates(&self) -> &[Candidate]
pub fn candidates(&self) -> &[Candidate]
What:
Every candidate,
in listing order.
&[Candidate] borrows the list read-only.
Why:
A candidate’s identity.index is its position in this list.
In TS you’d write (pseudocode):
get candidates(): readonly Candidate[]Sourcepub fn candidate_at_path(&self, path: &[u8]) -> Option<&Candidate>
pub fn candidate_at_path(&self, path: &[u8]) -> Option<&Candidate>
What:
The candidate at an exact pathname,
if this version changes it.
Option<&Candidate> is “a borrowed candidate or nothing”.
Why:
A policy that cares about specific files (a manifest,
a rules file) asks by
name instead of scanning the list or asking Git again.
In TS you’d write (pseudocode):
candidateAtPath(path: Buffer): Candidate | undefinedTrait Implementations§
Auto Trait Implementations§
impl Freeze for CandidateVersion
impl RefUnwindSafe for CandidateVersion
impl Send for CandidateVersion
impl Sync for CandidateVersion
impl Unpin for CandidateVersion
impl UnsafeUnpin for CandidateVersion
impl UnwindSafe for CandidateVersion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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