pub struct EpisodeList {
pub open: usize,
pub detached: usize,
pub episodes: Vec<ConnectionEpisode>,
pub mine: Option<ConnectionEpisode>,
}Expand description
The answer of episodes.list: every episode this server holds, counted by state, and the
one the caller holds. In memory only — it is the association between live connections and
the repository’s records, which stops being true when the process stops.
The two counts partition the list, and mine is left out of the JSON rather than written
as null when the caller holds nothing, which is always so over plain HTTP:
use majordomus_cli::capability::builtin::episodes::EpisodeList;
let none = EpisodeList { open: 0, detached: 0, episodes: vec![], mine: None };
let json = serde_json::to_value(&none).unwrap();
assert_eq!(json, serde_json::json!({"open": 0, "detached": 0, "episodes": []}));
let back: EpisodeList = serde_json::from_value(json).unwrap();
assert_eq!(back.open + back.detached, back.episodes.len());Fields§
§open: usizeHow many are open — held by a connection that is still there.
detached: usizeHow many are detached, waiting for a client to come back inside the grace. Not a fault count: this is where a crashed client’s work waits to be resumed.
episodes: Vec<ConnectionEpisode>Every episode, open and detached, in external-identity order.
mine: Option<ConnectionEpisode>The episode the calling connection holds, when it holds one.
Trait Implementations§
Source§impl Debug for EpisodeList
impl Debug for EpisodeList
Source§impl<'de> Deserialize<'de> for EpisodeList
impl<'de> Deserialize<'de> for EpisodeList
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
Source§impl JsonSchema for EpisodeList
impl JsonSchema for EpisodeList
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 moreAuto Trait Implementations§
impl Freeze for EpisodeList
impl RefUnwindSafe for EpisodeList
impl Send for EpisodeList
impl Sync for EpisodeList
impl Unpin for EpisodeList
impl UnsafeUnpin for EpisodeList
impl UnwindSafe for EpisodeList
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