Skip to main content

Stop

Enum Stop 

Source
pub enum Stop {
    End(&'static str),
    Damaged {
        offset: u64,
        why: &'static str,
    },
}
Expand description

Why scan stopped walking, as a type rather than as a comment.

scan had EIGHT break statements, four of which meant “the log genuinely ends here” and four of which meant “something is wrong here” – and all eight left through the same Ok((end, ..)) return, which open_impl then handed to set_len(end). So an injected EIO on a single header read returned a clean end and erased 640 of 1,280 bytes, and one flipped bit at the midpoint of a 3,000-row log destroyed 1,499 committed rows while open() returned Ok. Both measured (Task 17 final review, F4).

The distinction is now in the type system, so no exit can join the wrong one by accident:

  • End is the ONLY variant open_impl will truncate on.
  • Damaged refuses the open, touching nothing – and, because a refusal with no way out is its own Law 5 violation, recover() clears it by setting the whole log aside intact and reconstructing independently verified committed regions.
  • An I/O error is neither: it is not an answer about the log’s content at all, so it leaves scan as Err and never reaches this enum.

Variants§

§

End(&'static str)

The log genuinely ends at end. Everything from there to EOF is either a writer-shaped header whose bounded frame crosses physical EOF, or an all-zero extension. why names which proof was established.

§

Damaged

Something is wrong at offset. The remaining bytes may include committed frames regardless of how short they are. Nothing here may be discarded.

Fields

§offset: u64
§why: &'static str

Trait Implementations§

Source§

impl Clone for Stop

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Stop

Source§

impl Debug for Stop

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Stop

Source§

impl PartialEq for Stop

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Stop

Auto Trait Implementations§

§

impl Freeze for Stop

§

impl RefUnwindSafe for Stop

§

impl Send for Stop

§

impl Sync for Stop

§

impl Unpin for Stop

§

impl UnsafeUnpin for Stop

§

impl UnwindSafe for Stop

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.