pub struct State {
    pub prefs: Preferences,
    pub unsaved_changes: bool,
    pub filename: String,
    pub readonly: bool,
    pub last_search: Option<Vec<u8>>,
    pub index: usize,
    pub all_bytes: Vec<u8>,
    pub breaks: HashSet<usize>,
}

Fields

prefs: Preferencesunsaved_changes: boolfilename: Stringreadonly: boollast_search: Option<Vec<u8>>index: usizeall_bytes: Vec<u8>breaks: HashSet<usize>

Implementations

Return the byte numbers necessary for the left column of a display

Note: For the forseeable future, from_reader is actually slower than drawing the entire file into memory. So until that changes, doing the latter: https://github.com/serde-rs/json/issues/160

Return the range self.prefs.width bytes starting at address. Could be cut short by hitting end of all bytes. Could be empty because address is past end of all bytes.

Print self.prefs.width bytes from address or cut off if at end of all bytes

Returns the line to print and the index of the last byte printed

Return the range for the bytes in the current row

In current row, what’s the index of the last byte to show?

returns index of the last byte printed in the non-context line

returns index of the first byte printed on the last line This is more primitive than print_bytes. It just prints the bytes from the range.

Trait Implementations

Formats the value using the given formatter. Read more

Serialize to a json blob. Don’t include all_bytes, not only because it could be huge, but because if you load a state from disk and its bytes differ from the actual file’s on disk bytes, neither collection of bytes are canonical. User’s can write out bytes to other files at will.

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.