Skip to main content

State

Enum State 

Source
pub enum State {
    NothingExtracted,
    Unchanged,
    Edited,
    Diverged,
    ContainerGone,
    ContainerChanged {
        recorded: String,
        found: String,
    },
    Unreadable(String),
}
Expand description

What a session left behind turned out to be.

Variants§

§

NothingExtracted

No content file in the session directory. The session died between being created and being filled, so there is nothing to recover and nothing to ask about.

§

Unchanged

The content file still matches the one in the container. Nothing was lost: clean up and say nothing.

§

Edited

The content file differs from the one in the container, and the container is still holding what this session last agreed with it about. So the difference is this session’s own edit and nobody else’s, and it goes back.

§

Diverged

The content file differs from the container and the container is not what it was when the two last agreed. Both sides moved.

The one case worth interrupting for. Writing back would throw away whatever changed the container, and discarding would throw away the edit; there is no answer here that is not somebody’s decision. It is also rare: it needs a second writer to the same container while this session was not running.

§

ContainerGone

The container is no longer where the session recorded it. Concept 6.4 requires surviving this rather than failing at the rename: the content file is still here, and the person can be offered somewhere else to put it.

§

ContainerChanged

Something is at the recorded path, and it is not the container this session was opened against — its content file goes by another name. Writing back would rename the content file of a container somebody else’s session may be holding.

Fields

§recorded: String

What the session recorded.

§found: String

What the file at that path says now.

§

Unreadable(String)

The container is there and cannot be read, or the content file cannot be. A question for a person rather than an answer.

Implementations§

Source§

impl State

Source

pub fn course(&self) -> Course

What to do about it.

Source

pub fn needs_a_person(&self) -> bool

Whether a person has to be asked about this one.

Source

pub fn is_ours_to_write_back(&self) -> bool

Whether this one is recovery’s own to put back.

Source

pub fn is_quiet(&self) -> bool

Whether it can be removed with nothing said.

Not !needs_a_person(), which is what it used to be and what would now sweep away an edit. See Course.

Trait Implementations§

Source§

impl Debug for State

Source§

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

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

impl Display for State

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for State

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnsafeUnpin for State

§

impl UnwindSafe for State

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
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