pub enum StartReason {
Process,
Resume,
Clear,
Join,
Other,
}Expand description
Why a session_started record is there (01M3X9X9M079WGFPJZHNXH9VEP). A start call
sends process, resume or clear.
| Reason | Meaning | A fresh context |
|---|---|---|
process | A new agent process. | Yes |
resume | The agent process resumed an old conversation. | No |
clear | The agent cleared its context. | Yes |
join | The session came with no new start: a register. | No |
other | A reason that this build does not know. | No |
use riff_core::wire::StartReason;
let read = |json: &str| serde_json::from_str::<StartReason>(json).unwrap();
assert_eq!(read(r#""process""#), StartReason::Process);
assert_eq!(read(r#""wake""#), StartReason::Other);
// A reason of a later build can have each form of JSON.
for later in [r#"{"wake":"timer"}"#, "7", "null", r#"["clear"]"#] {
assert_eq!(read(later), StartReason::Other, "{later}");
}
assert!(StartReason::Clear.is_fresh() && StartReason::Process.is_fresh());
assert!(!StartReason::Resume.is_fresh() && !StartReason::Join.is_fresh());
assert!(StartReason::Resume.is_start() && !StartReason::Join.is_start());
assert_eq!(StartReason::Clear.word(), "clear");Variants§
Implementations§
Trait Implementations§
Source§impl Clone for StartReason
impl Clone for StartReason
Source§fn clone(&self) -> StartReason
fn clone(&self) -> StartReason
Returns a duplicate of the value. Read more
1.0.0 · 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 StartReason
impl Debug for StartReason
Source§impl<'de> Deserialize<'de> for StartReason
The set of reasons can grow. A build reads each value that it does
not know as StartReason::Other: a text, and each other form of
JSON (01M3XM2C18TT8VSKGD77YPZG53).
impl<'de> Deserialize<'de> for StartReason
The set of reasons can grow. A build reads each value that it does
not know as StartReason::Other: a text, and each other form of
JSON (01M3XM2C18TT8VSKGD77YPZG53).
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for StartReason
impl JsonSchema for StartReason
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 StartReason
impl PartialEq for StartReason
Source§impl Serialize for StartReason
impl Serialize for StartReason
impl Copy for StartReason
impl Eq for StartReason
impl StructuralPartialEq for StartReason
Auto Trait Implementations§
impl Freeze for StartReason
impl RefUnwindSafe for StartReason
impl Send for StartReason
impl Sync for StartReason
impl Unpin for StartReason
impl UnsafeUnpin for StartReason
impl UnwindSafe for StartReason
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.