Skip to main content

ListerOptions

Struct ListerOptions 

Source
pub struct ListerOptions {
    pub other: Vec<String>,
    pub sort: Option<SortKeys>,
    pub offset: Option<usize>,
    pub before: Option<String>,
    pub after: Option<String>,
    pub limit: Option<usize>,
    pub output: Option<String>,
}
Expand description

Output-format and pagination requests for a Lister.

Default leaves all optional fields unset and other empty: no caller limit, no skipped entries or cursor bounds, and the program’s default order and output format. The collection URL is supplied separately by the runner.

These fields express requested behavior, not program capabilities; supply known native support separately using ListerCapabilities. Sorting and all pagination options have explicit native capabilities, and the portable sort-expression grammar is still unresolved. Use only keys and syntax supported by the selected program’s profile. Concrete hosts must distinguish native support from emulation; see crate::programs for links to the runner’s currently implemented behavior.

§Examples

use asimov_patterns::ListerOptions;

let options = ListerOptions::builder()
    .offset(20)
    .limit(100)
    .output("jsonl")
    .build();

let cursor_page = ListerOptions::builder()
    .after("urn:example:entry:123")
    .limit(25)
    .build();
assert_eq!(cursor_page.after.as_deref(), Some("urn:example:entry:123"));
assert!(cursor_page.offset.is_none());

Fields§

§other: Vec<String>

Additional arguments placed after generated options and before the URL.

Each string is one literal argument, without shell expansion. The runner supplies the URL separately; do not duplicate it here. See crate::programs.

§sort: Option<SortKeys>

Ordering request passed as --sort=SORT using SortKeys’ display syntax.

SortKeys uses a - prefix for descending keys. This is the SDK’s representation, not a universally supported PPS grammar; the program must support both the option and the resulting expression. None omits the request and uses the program’s documented default order.

§offset: Option<usize>

Number of entries to skip, passed as --offset=COUNT.

None omits the option (default 0); Some(0) explicitly skips none. Offset is applied after sorting and before the limit. Programs may omit native support. Do not combine an offset, even Some(0), with before or after; these are alternative pagination modes.

§before: Option<String>

Exclusive upper cursor bound, passed as --before=URI.

The URI identifies an entry by its JSON-LD @id; it is an absolute URI string, not a JSON object or an opaque encoded cursor. Select entries before that entry in the chosen sort order. May be combined with after to bound an interval, but not with numeric offset. None omits the bound. The options value stores this string without validation or normalization.

§after: Option<String>

Exclusive lower cursor bound, passed as --after=URI.

The URI identifies an entry by its JSON-LD @id. Select entries after that entry in the chosen sort order. May be combined with before, but not with numeric offset. None omits the bound. As with before, the options value stores the absolute URI string without validating it.

§limit: Option<usize>

Requested listing limit (--limit=COUNT, or -n, when forwarded natively).

None imposes no caller-requested limit; Some(0) requests no entries. ListerCapabilities::limit describes native support. A host can enforce the request even when the native flag is unsupported, and independently cap output to protect against bugs in programs that do accept the flag. The program contract counts complete entries, not RDF statements, lines, or bytes; consult the runner’s listing behavior for its additional line-based cap and zero-limit handling. This options value does not validate entry boundaries.

§output: Option<String>

RDF serialization passed as --output=FORMAT (-o in the CLI).

None omits the option; the specified program default is jsonl. The option does not define how an entry maps to RDF or select a file.

Implementations§

Source§

impl ListerOptions

Source

pub fn builder() -> ListerOptionsBuilder

Create an instance of ListerOptions using the builder syntax

Trait Implementations§

Source§

impl Clone for ListerOptions

Source§

fn clone(&self) -> Self

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 ListerOptions

Source§

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

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

impl Default for ListerOptions

Source§

fn default() -> Self

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

impl Eq for ListerOptions

Source§

impl Hash for ListerOptions

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ListerOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ListerOptions

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, 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.