pub enum CloseReason {
Detach,
Shutdown,
Expired,
}Expand description
Why an episode was closed. Reported to the repository as the end event’s reason, where
share/providers.yaml’s deliberate-end list decides whether the record says closed or
interrupted — the same table the provider hooks are read through, so a connection
episode and a hook episode cannot disagree about what “ended deliberately” means.
The serialised word and CloseReason::as_str are one vocabulary:
use majordomus_cli::episodes::CloseReason;
for reason in [CloseReason::Detach, CloseReason::Shutdown, CloseReason::Expired] {
let json = serde_json::to_string(&reason).unwrap();
assert_eq!(json, format!("\"{}\"", reason.as_str()));
}Variants§
Detach
The client said so: episodes.detach, or DELETE /mcp. A deliberate end.
Shutdown
The server is stopping and every episode goes with it. Deliberate: nothing was cut short by this, the machine was.
Expired
The connection went and did not come back inside REATTACH_GRACE. Not deliberate,
and the record says interrupted, because calling a crashed episode complete is the
worse of the two mistakes.
Implementations§
Source§impl CloseReason
impl CloseReason
Sourcepub fn as_str(self) -> &'static str
pub fn as_str(self) -> &'static str
The word sent to the repository’s end event, as its reason. Only expired is
outside the deliberate-end list, so only it records the episode as interrupted.
use majordomus_cli::episodes::CloseReason;
assert_eq!(CloseReason::Detach.as_str(), "detach");
assert_eq!(CloseReason::Expired.as_str(), "expired");Trait Implementations§
Source§impl Clone for CloseReason
impl Clone for CloseReason
Source§fn clone(&self) -> CloseReason
fn clone(&self) -> CloseReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CloseReason
Source§impl Debug for CloseReason
impl Debug for CloseReason
Source§impl<'de> Deserialize<'de> for CloseReason
impl<'de> Deserialize<'de> for CloseReason
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 CloseReason
Source§impl JsonSchema for CloseReason
impl JsonSchema for CloseReason
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 moreSource§impl PartialEq for CloseReason
impl PartialEq for CloseReason
Source§fn eq(&self, other: &CloseReason) -> bool
fn eq(&self, other: &CloseReason) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for CloseReason
impl Serialize for CloseReason
impl StructuralPartialEq for CloseReason
Auto Trait Implementations§
impl Freeze for CloseReason
impl RefUnwindSafe for CloseReason
impl Send for CloseReason
impl Sync for CloseReason
impl Unpin for CloseReason
impl UnsafeUnpin for CloseReason
impl UnwindSafe for CloseReason
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.