pub struct ClosedSessions {
pub total: usize,
pub on_this_branch: usize,
pub newest: Vec<ClosedSession>,
pub window: usize,
}Expand description
The tracked half of the subsystem: the records a clone receives.
total is exact and newest is a window, and keeping them as two numbers is the whole
design of this type. The tracked directory grows without bound and a Cockpit card is not
a listing page, so the rows are capped — but a capped list that did not carry the true
total would quietly understate the repository, which is the shape of defect this
repository has been bitten by often enough to name. window says how many rows came
back, so a reader can see the cap rather than infer it.
use majordomus_cli::capability::builtin::lifecycle::ClosedSessions;
use serde_json::json;
let row = |id: &str| json!({
"session_id": id,
"uri": format!("majordomus://session/{id}"),
"path": format!(".ai/repo/project/sessions/{id}.md"),
"branch": "master",
});
let c: ClosedSessions = serde_json::from_value(json!({
"total": 137,
"on_this_branch": 41,
"newest": [row("s-0137"), row("s-0136")],
"window": 2,
})).unwrap();
// the window is what came back; the total is what exists
assert_eq!(c.window, c.newest.len());
assert!(c.total > c.window, "the rows are capped and the total is not");
assert!(c.on_this_branch <= c.total);Fields§
§total: usizeHow many closed records the index holds. Exact.
on_this_branch: usizeHow many of them closed on the branch this checkout is on.
newest: Vec<ClosedSession>The newest CLOSED_WINDOW, newest first.
window: usizeHow many are carried in newest, against the total.
Trait Implementations§
Source§impl Clone for ClosedSessions
impl Clone for ClosedSessions
Source§fn clone(&self) -> ClosedSessions
fn clone(&self) -> ClosedSessions
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 moreSource§impl Debug for ClosedSessions
impl Debug for ClosedSessions
Source§impl<'de> Deserialize<'de> for ClosedSessions
impl<'de> Deserialize<'de> for ClosedSessions
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ClosedSessions
Source§impl JsonSchema for ClosedSessions
impl JsonSchema for ClosedSessions
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for ClosedSessions
impl PartialEq for ClosedSessions
Source§fn eq(&self, other: &ClosedSessions) -> bool
fn eq(&self, other: &ClosedSessions) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ClosedSessions
impl Serialize for ClosedSessions
impl StructuralPartialEq for ClosedSessions
Auto Trait Implementations§
impl Freeze for ClosedSessions
impl RefUnwindSafe for ClosedSessions
impl Send for ClosedSessions
impl Sync for ClosedSessions
impl Unpin for ClosedSessions
impl UnsafeUnpin for ClosedSessions
impl UnwindSafe for ClosedSessions
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
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
Compare self to
key and return true if they are equal.