pub struct HexView<'s, S: HexSource + ?Sized> { /* private fields */ }Implementations§
Source§impl<'s, S: HexSource + ?Sized> HexView<'s, S>
impl<'s, S: HexSource + ?Sized> HexView<'s, S>
pub fn new(source: &'s S, selection: &'s mut Option<Selection>) -> Self
Sourcepub fn field_boundaries(self, boundaries: &'s [(ByteOffset, ByteLen)]) -> Self
pub fn field_boundaries(self, boundaries: &'s [(ByteOffset, ByteLen)]) -> Self
Supply leaf-field byte ranges from a template. The view paints a thin outline at each range’s edges so users can see where template fields start and end without looking at the side panel. Must be sorted by start; caller guarantees no overlap.
Sourcepub fn field_colors(self, colors: &'s [Color32]) -> Self
pub fn field_colors(self, colors: &'s [Color32]) -> Self
Per-field colour, parallel to field_boundaries. The minimap
overrides its byte-palette / grayscale fill with this colour
for bytes that fall inside a field, so the overview strip
matches the colouring the user sees in the main view.
Sourcepub fn id_salt(self, salt: impl Hash) -> Self
pub fn id_salt(self, salt: impl Hash) -> Self
Stable seed for this view’s internal widget ids. egui runs two
layout passes; without a stable salt the hex body and column
header – both giant allocate_exact_size widgets – get auto-
ids derived from call-site position, which drifts under
egui_dock’s tab shuffling and triggers “Widget rect changed id
between passes” warnings. Callers should pass something tied
to the tab (e.g. FileId).
Sourcepub fn hover_span(self, span: Option<ByteRange>) -> Self
pub fn hover_span(self, span: Option<ByteRange>) -> Self
Tell the hex view to draw a secondary highlight over the given
byte range. Consumer-driven; cleared when None is passed.
Sourcepub fn byte_styler(self, f: impl Fn(u8, ByteOffset) -> ByteStyle + 's) -> Self
pub fn byte_styler(self, f: impl Fn(u8, ByteOffset) -> ByteStyle + 's) -> Self
Install a per-byte styler. When set, the callback’s returned
ByteStyle takes precedence over the palette for that byte.
None fields in the returned style fall back to the palette’s
choice (or theme default).
Sourcepub fn address_formatter(
self,
f: impl Fn(ByteOffset, usize) -> String + 's,
) -> Self
pub fn address_formatter( self, f: impl Fn(ByteOffset, usize) -> String + 's, ) -> Self
Override the address-column label formatter. Default is uppercase zero-padded hex.
Sourcepub fn column_header_formatter(self, f: impl Fn(usize) -> String + 's) -> Self
pub fn column_header_formatter(self, f: impl Fn(usize) -> String + 's) -> Self
Override the column-header label formatter. Default is a single uppercase hex digit.
Sourcepub fn scroll_to(self, offset: f32) -> Self
pub fn scroll_to(self, offset: f32) -> Self
Scroll the view to offset (in pixels from the top of content)
on this frame. Useful for restoring a saved scroll position on
file reopen.
Sourcepub fn scroll_to_byte(self, byte: ByteOffset) -> Self
pub fn scroll_to_byte(self, byte: ByteOffset) -> Self
Scroll so the row containing byte is near the top of the
visible area. Resolved at render time using the current font
and column settings; takes precedence over scroll_to.
Sourcepub fn minimap(self, enabled: bool) -> Self
pub fn minimap(self, enabled: bool) -> Self
Draw a narrow “minimap” strip on the right-hand side of the view that shows the full file colored by the current palette, with a viewport indicator, and supports click/drag to scroll.
Sourcepub fn minimap_colored(self, colored: bool) -> Self
pub fn minimap_colored(self, colored: bool) -> Self
When the minimap is enabled, toggle whether bytes are painted in the highlight palette’s colours or as a simple grayscale gradient keyed on byte value. Off is less busy.
pub fn columns(self, cols: ColumnCount) -> Self
Sourcepub fn value_highlight(self, mode: Option<ValueHighlight>) -> Self
pub fn value_highlight(self, mode: Option<ValueHighlight>) -> Self
Toggle value-class highlighting. None disables, Some(mode)
enables with either a background fill or text recoloring.
Sourcepub fn palette(self, palette: HighlightPalette) -> Self
pub fn palette(self, palette: HighlightPalette) -> Self
Override the built-in theme-based palette. Use this to plug in a class palette, a value gradient, or (later) a custom colour scheme.
Install a context-menu callback rendered when the user right-clicks anywhere in the hex or ASCII pane. Callers use this to add per-app commands like Copy.