Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 18 fields pub app: App, pub snapshot: Snapshot, pub profile: Option<String>, pub source: ListSource, pub visible: Vec<usize>, pub list: ListState, pub focus: Focus, pub mode: Mode, pub view_scroll: u16, pub content_lines: usize, pub content_cache: HashMap<Uuid, Rendered>, pub cmdline: CmdLine, pub expand: bool, pub message: Option<(Level, String)>, pub stale_warned: bool, pub quit: bool, pub list_height: u16, pub view_height: u16,
}

Fields§

§app: App§snapshot: Snapshot§profile: Option<String>

Profile scope; None = all profiles.

§source: ListSource§visible: Vec<usize>

Indices into snapshot.rows: current source ∩ profile scope.

§list: ListState§focus: Focus§mode: Mode§view_scroll: u16§content_lines: usize

Pre-wrap line count of the selected jot’s content.

§content_cache: HashMap<Uuid, Rendered>§cmdline: CmdLine§expand: bool

Transclusion in the content view (x toggles): expanded content comes from cuj’s show –expand path.

§message: Option<(Level, String)>§stale_warned: bool

The stale-index warning fires once per snapshot.

§quit: bool§list_height: u16

Viewport heights, updated by the draw pass.

§view_height: u16

Implementations§

Source§

impl AppState

Source

pub fn new(app: App) -> Result<AppState>

Source

pub fn scope(&self) -> Option<&str>

Source

pub fn recompute_visible(&mut self)

Rebuild visible from source ∩ scope and clamp selection.

Source

pub fn selected_row(&self) -> Option<&JotRow>

Source

pub fn select_index(&mut self, i: usize)

Select by position in visible, resetting the view scroll.

Source

pub fn select_entry(&mut self, entry: Uuid) -> bool

Select the row holding entry, if visible.

Source

pub fn set_message(&mut self, level: Level, text: impl Into<String>)

Source

pub fn ensure_content(&mut self)

Load the selected jot’s content into the cache (head-only, so Vault::get_bytes suffices — no transient Reads needed), highlighted under its profile’s parser configuration, and clamp the view scroll. Called once per loop iteration, before drawing.

Source

pub fn content_of(&self, entry: Uuid) -> Option<&Rendered>

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.