Skip to main content

Page

Struct Page 

Source
pub struct Page {
    pub header: String,
    pub body: String,
    pub total_matches: usize,
    pub total_files: usize,
    pub first_index: usize,
    pub last_index: usize,
    pub last_key: Option<(String, u64)>,
    pub has_more: bool,
    pub fingerprint: u64,
}
Expand description

A rendered page: surface-agnostic header + body, plus the counts and keyset state each caller (CLI / MCP) needs to mint the “next page” cursor and detect a changed result set.

Fields§

§header: String§body: String§total_matches: usize§total_files: usize§first_index: usize

1-based index of the first/last entry on this page (in matches, or files for -l/-c); 0 when empty.

§last_index: usize§last_key: Option<(String, u64)>

Keyset key of the last rendered entry, to seed the next cursor; None when nothing remains.

§has_more: bool§fingerprint: u64

Fingerprint of the full result set, for staleness detection across pages.

Implementations§

Source§

impl Page

Source

pub fn next_cursor( &self, mode: Mode, pattern: String, opts: SearchOptions, page_size: usize, root_hint: Option<String>, ) -> Option<Cursor>

The cursor that fetches the page after this one, or None when this is the last page. Both the CLI and MCP surfaces mint it the same way; root_hint is the only per-surface input (the resolved root for the CLI, None for MCP where the server root is authoritative).

Source

pub fn staleness_note(&self, prev: Option<(usize, u32)>) -> Option<String>

A note for the caller to surface when resuming a cursor whose result set has since changed (fingerprint mismatch), or None. prev is the cursor’s (prev_total, fingerprint); the fingerprint is the low 32 bits, so compare against this page’s truncated to match.

Auto Trait Implementations§

§

impl Freeze for Page

§

impl RefUnwindSafe for Page

§

impl Send for Page

§

impl Sync for Page

§

impl Unpin for Page

§

impl UnsafeUnpin for Page

§

impl UnwindSafe for Page

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.