pub struct Query {
pub view: Option<View>,
pub claims: Option<ClaimFilter>,
pub after: Option<u64>,
pub session: Option<String>,
pub runtime: Option<String>,
pub kind: Option<Kind>,
pub limit: Option<usize>,
pub open: Option<bool>,
pub matching: Option<String>,
}Expand description
What a reader asks of the folded state. Every filter narrows; none changes a shape, and an input it does not know is refused rather than ignored.
use majordomus_cli::mesh::page::{ClaimFilter, Query, View};
let q: Query = serde_json::from_str(r#"{"view":"full","claims":"live","limit":5}"#).unwrap();
assert_eq!(q.view(), View::Full);
assert_eq!((q.claims, q.limit), (Some(ClaimFilter::Live), Some(5)));
assert!(serde_json::from_str::<Query>(r#"{"views":"full"}"#).is_err());Fields§
§view: Option<View>summary (the default) or full.
claims: Option<ClaimFilter>all (the default) or live: whether ended claims are kept.
after: Option<u64>Only sessions, claims and handovers whose latest Lamport stamp is above this. Reviews and overlaps carry no stamp of their own and are kept or dropped with their sessions.
session: Option<String>Only what belongs to this session: its key (<stream>/<session>) or its bare id.
runtime: Option<String>Only what belongs to this runtime: <node>-<runtime>, or a node id for every runtime
of that machine.
kind: Option<Kind>Only this collection; the others are answered empty.
limit: Option<usize>At most this many of each collection: the newest by Lamport stamp where it has one, kept in the fold’s own order.
open: Option<bool>Only what is still open: active sessions, live claims, review requests nobody has answered and handovers nobody has taken.
matching: Option<String>Only what mentions this text, ignoring case: a path, a branch, an issue, a pull request, a word of an intent or a subject.
Implementations§
Source§impl Query
impl Query
Sourcepub fn view(&self) -> View
pub fn view(&self) -> View
The view asked for, the summary when none was: the one place the default is decided, so every capability that takes a query answers the same view for the same input.
use majordomus_cli::mesh::page::{Query, View};
assert_eq!(Query::default().view(), View::Summary);
let full = Query { view: Some(View::Full), ..Query::default() };
assert_eq!(full.view(), View::Full);Trait Implementations§
Source§impl BenchmarkCases for Query
impl BenchmarkCases for Query
Source§fn benchmark_cases(_: &CaseContext<'_>) -> Vec<NamedCase<Self>>
fn benchmark_cases(_: &CaseContext<'_>) -> Vec<NamedCase<Self>>
Source§fn benchmark_cases_json(ctx: &CaseContext<'_>) -> Vec<NamedCase<Value>>
fn benchmark_cases_json(ctx: &CaseContext<'_>) -> Vec<NamedCase<Value>>
Source§impl<'de> Deserialize<'de> for Query
impl<'de> Deserialize<'de> for Query
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Query
Source§impl JsonSchema for Query
impl JsonSchema for Query
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.