pub struct PaginationConfig {
pub default_limit: i64,
pub max_limit: i64,
}Expand description
Opt-in pagination policy for a single command, set with
CommandSpec::with_pagination.
Registering this is what makes --limit/--offset exist for a command at
all — without it, the engine does not register those flags, so they are
absent from --help and rejected as unknown arguments if passed. Construct
it with ..Default::default(), as in the example below, so a future
engine release can add fields without breaking existing callers.
use cli_engine::PaginationConfig;
let pagination = PaginationConfig {
default_limit: 20,
max_limit: 100,
..Default::default()
};
assert_eq!(pagination.default_limit, 20);Fields§
§default_limit: i64Page size applied when the user passes neither --limit nor
--offset. 0 (the default) means unlimited — the same “no
pagination” sentinel used everywhere else in the output pipeline.
max_limit: i64Upper bound a user can request with an explicit --limit. 0 (the
default) means uncapped. Does not affect default_limit itself.
Trait Implementations§
Source§impl Clone for PaginationConfig
impl Clone for PaginationConfig
Source§fn clone(&self) -> PaginationConfig
fn clone(&self) -> PaginationConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PaginationConfig
Source§impl Debug for PaginationConfig
impl Debug for PaginationConfig
Source§impl Default for PaginationConfig
impl Default for PaginationConfig
Source§fn default() -> PaginationConfig
fn default() -> PaginationConfig
Returns the “default value” for a type. Read more
impl Eq for PaginationConfig
Source§impl PartialEq for PaginationConfig
impl PartialEq for PaginationConfig
impl StructuralPartialEq for PaginationConfig
Auto Trait Implementations§
impl Freeze for PaginationConfig
impl RefUnwindSafe for PaginationConfig
impl Send for PaginationConfig
impl Sync for PaginationConfig
impl Unpin for PaginationConfig
impl UnsafeUnpin for PaginationConfig
impl UnwindSafe for PaginationConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.