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
impl ListerOptions
Sourcepub fn builder() -> ListerOptionsBuilder
pub fn builder() -> ListerOptionsBuilder
Create an instance of ListerOptions using the builder syntax