Skip to main content

HexView

Struct HexView 

Source
pub struct HexView<'s, S: HexSource + ?Sized> { /* private fields */ }

Implementations§

Source§

impl<'s, S: HexSource + ?Sized> HexView<'s, S>

Source

pub fn new(source: &'s S, selection: &'s mut Option<Selection>) -> Self

Source

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.

Source

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.

Source

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).

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn columns(self, cols: ColumnCount) -> Self

Source

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.

Source

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.

Source

pub fn context_menu(self, add_contents: impl FnOnce(&mut Ui) + 's) -> Self

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.

Source

pub fn show(self, ui: &mut Ui) -> HexViewResponse

Auto Trait Implementations§

§

impl<'s, S> Freeze for HexView<'s, S>
where S: ?Sized,

§

impl<'s, S> !RefUnwindSafe for HexView<'s, S>

§

impl<'s, S> !Send for HexView<'s, S>

§

impl<'s, S> !Sync for HexView<'s, S>

§

impl<'s, S> Unpin for HexView<'s, S>
where S: ?Sized,

§

impl<'s, S> UnsafeUnpin for HexView<'s, S>
where S: ?Sized,

§

impl<'s, S> !UnwindSafe for HexView<'s, S>

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, 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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.