Struct edhex_core::State [−][src]
pub struct State {Show 15 fields
pub radix: u32,
pub show_byte_numbers: bool,
pub show_chars: bool,
pub unsaved_changes: bool,
pub filename: String,
pub show_prompt: bool,
pub color: bool,
pub readonly: bool,
pub index: usize,
pub width: NonZeroUsize,
pub all_bytes: Vec<u8>,
pub n_padding: String,
pub before_context: usize,
pub after_context: usize,
pub last_search: Option<Vec<u8>>,
}
Fields
radix: u32
show_byte_numbers: bool
show_chars: bool
unsaved_changes: bool
filename: String
show_prompt: bool
color: bool
readonly: bool
index: usize
width: NonZeroUsize
all_bytes: Vec<u8>
n_padding: String
before_context: usize
after_context: usize
last_search: Option<Vec<u8>>
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
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.
Return the range self.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.width
bytes from address
or cut off if at end of all bytes
pub fn bytes_from_current_row(&self) -> &[u8]ⓘ
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 byte in the 0-th column of the main row printed (not the context rows)
returns index of the byte in the 0-th column of the last row printed
This is more primitive than print_bytes
. It just prints the bytes
from the range.
Trait Implementations
Performs the conversion.