pub struct PrivateIndex { /* private fields */ }Expand description
What: A private index file in a directory this value owns. Fields are private, so the directory can be removed only by dropping the value. Why: Every path out of a prediction, failures included, removes the directory.
In TS you’d write (pseudocode):
class PrivateIndex { readonly #directory: string; readonly #index: string; [Symbol.dispose]() {} }Implementations§
Source§impl PrivateIndex
What:
impl PrivateIndex { ... } attaches the constructor and the accessor.
Why:
The directory is created and filled in one step,
so no caller sees a half-made copy.
impl PrivateIndex
What:
impl PrivateIndex { ... } attaches the constructor and the accessor.
Why:
The directory is created and filled in one step,
so no caller sees a half-made copy.
In TS you’d write (pseudocode):
class PrivateIndex { static create(realIndex: string): PrivateIndex; get path(): string }Sourcepub fn create(real_index: &Path) -> Result<PrivateIndex, CandidateError>
pub fn create(real_index: &Path) -> Result<PrivateIndex, CandidateError>
What:
Create the directory beside real_index and copy the index into it.
Why:
Beside the real index keeps the copy on the same filesystem and inside the
Git directory,
where the installed wrapper also put it.
In TS you’d write (pseudocode):
static async create(realIndex: string): Promise<PrivateIndex>;Trait Implementations§
Source§impl Debug for PrivateIndex
impl Debug for PrivateIndex
Source§impl Drop for PrivateIndex
What:
impl Drop for PrivateIndex runs drop when the value goes out of scope,
like
a [Symbol.dispose] that the language calls on every exit path.
Why:
The directory and everything Git wrote into it are removed whether the
prediction succeeded or failed.
impl Drop for PrivateIndex
What:
impl Drop for PrivateIndex runs drop when the value goes out of scope,
like
a [Symbol.dispose] that the language calls on every exit path.
Why:
The directory and everything Git wrote into it are removed whether the
prediction succeeded or failed.
In TS you’d write (pseudocode):
[Symbol.dispose]() { rmSync(this.#directory, { recursive: true, force: true }); }Auto Trait Implementations§
impl Freeze for PrivateIndex
impl RefUnwindSafe for PrivateIndex
impl Send for PrivateIndex
impl Sync for PrivateIndex
impl Unpin for PrivateIndex
impl UnsafeUnpin for PrivateIndex
impl UnwindSafe for PrivateIndex
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