Skip to main content

MailboxBuffers

Struct MailboxBuffers 

Source
pub struct MailboxBuffers {
Show 20 fields pub inbox: Vec<MessageRow>, pub sent: Vec<MessageRow>, pub channel: Vec<MessageRow>, pub wire: Vec<MessageRow>, pub inbox_after: i64, pub sent_after: i64, pub channel_after: i64, pub wire_after: i64, pub inbox_cursor: CursorState, pub sent_cursor: CursorState, pub channel_cursor: CursorState, pub wire_cursor: CursorState, pub inbox_filter: String, pub sent_filter: String, pub channel_filter: String, pub wire_filter: String, pub inbox_search: String, pub sent_search: String, pub channel_search: String, pub wire_search: String,
}
Expand description

Per-agent buffer state — four tabs, four after_id cursors. Lives on App so swapping the focused agent resets the cursors without trying to back-fill: the operator sees only forward motion in the tab they’re watching.

Fields§

§inbox: Vec<MessageRow>§sent: Vec<MessageRow>§channel: Vec<MessageRow>§wire: Vec<MessageRow>§inbox_after: i64§sent_after: i64§channel_after: i64§wire_after: i64§inbox_cursor: CursorState§sent_cursor: CursorState§channel_cursor: CursorState§wire_cursor: CursorState§inbox_filter: String§sent_filter: String§channel_filter: String§wire_filter: String§inbox_search: String§sent_search: String§channel_search: String§wire_search: String

Implementations§

Source§

impl MailboxBuffers

Source

pub fn rows(&self, tab: MailboxTab) -> &[MessageRow]

Source

pub fn visible_indices(&self, tab: MailboxTab) -> Vec<usize>

Indices into rows(tab) for the rows currently presented to the operator — filter ∩ search. PR-2 swapped this body in; every cursor method and the render call site stayed unchanged from PR-1 because they go through this abstraction. A row at rows(tab)[i] is visible iff:

  1. filter_text(tab) is empty OR row.sender (lower-cased) contains the filter (lower-cased) as a substring.
  2. search_text(tab) is empty OR row.text (lower-cased) contains the search (lower-cased) as a substring.

When both axes are empty, the result is identity (0..rows.len()) — PR-1’s default behavior recovers exactly. Case-insensitive substring is the documented contract; the per-keystroke recompute on small (~500-row) buffers is well within budget.

Source

pub fn filter_text(&self, tab: MailboxTab) -> &str

Current sender-substring filter on tab; empty = no filter.

Source

pub fn search_text(&self, tab: MailboxTab) -> &str

Current body-substring search on tab; empty = no search.

Source

pub fn input_push_char( &mut self, tab: MailboxTab, kind: MailboxInputKind, c: char, )

Push c onto the active input buffer for tab, then clamp the cursor against the (possibly shorter) new visible_indices. Called per-keystroke by the App input-mode handler.

Source

pub fn input_pop_char(&mut self, tab: MailboxTab, kind: MailboxInputKind)

Pop one character (Backspace) from the active input buffer for tab, then re-clamp the cursor.

Source

pub fn set_input( &mut self, tab: MailboxTab, kind: MailboxInputKind, value: String, )

Replace the active input buffer for tab wholesale — used by the Esc-cancel-revert path to restore the pre-open snapshot.

Source

pub fn cursor(&self, tab: MailboxTab) -> &CursorState

Source

pub fn move_cursor_down(&mut self, tab: MailboxTab)

Move the cursor one row toward the tail; clamps at the last visible row (vim-like — no wrap).

Source

pub fn move_cursor_up(&mut self, tab: MailboxTab)

Move the cursor one row toward the head; clamps at 0.

Source

pub fn page_cursor_down(&mut self, tab: MailboxTab)

Jump a screen toward the tail.

Source

pub fn page_cursor_up(&mut self, tab: MailboxTab)

Jump a screen toward the head.

Source

pub fn cursor_home(&mut self, tab: MailboxTab)

Jump to the first visible row.

Source

pub fn cursor_end(&mut self, tab: MailboxTab)

Jump to the last visible row.

Source

pub fn extend(&mut self, tab: MailboxTab, batch: Vec<MessageRow>)

Fold a freshly-fetched batch into the appropriate tab, trimming to the last MAX_TAB_ROWS. Bumps the broker pagination cursor to the last returned id when the batch is non-empty. T-131 PR-1: when the UI cursor was already at the tail (or the tab was empty), follow new arrivals — matching the pre-T-131 “tail to whatever fits” UX. Always re-clamps the UI cursor against the (possibly drained) post-extend visible length so a stale index can never reference a missing row.

Source

pub fn reset(&mut self)

Reset every tab’s contents and cursor. Called when the focused agent changes — the new agent’s inbox filter would otherwise skip historical rows that landed before our last inbox_after, and the UI cursor would point into the wrong agent’s buffer.

Trait Implementations§

Source§

impl Clone for MailboxBuffers

Source§

fn clone(&self) -> MailboxBuffers

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MailboxBuffers

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MailboxBuffers

Source§

fn default() -> MailboxBuffers

Returns the “default value” for a type. Read more

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more