pub struct ForkId(pub String);Tuple Fields§
§0: StringImplementations§
Source§impl ForkId
impl ForkId
Sourcepub fn new(value: impl Into<String>) -> Self
pub fn new(value: impl Into<String>) -> Self
Examples found in repository?
examples/replay_and_fork.rs (line 31)
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let state = YoAgentState::load(MemoryEventStore::new()).await?;
9 let first = state
10 .apply_ops(
11 ActorRef::agent("demo"),
12 vec![StateOp::CreateNode {
13 id: NodeId::new("goal_1"),
14 kind: "goal".to_string(),
15 props: json!({ "title": "Improve retry reliability" }),
16 }],
17 )
18 .await?;
19 state
20 .apply_ops(
21 ActorRef::agent("demo"),
22 vec![StateOp::CreateNode {
23 id: NodeId::new("task_1"),
24 kind: "task".to_string(),
25 props: json!({ "title": "Investigate timeout" }),
26 }],
27 )
28 .await?;
29
30 let fork = state
31 .fork_at_event(ForkId::new("fork_before_task"), Some(first))
32 .await?;
33 let diff = diff_graphs(&fork.graph, &state.graph().await);
34 println!("fork_nodes={}", fork.graph.nodes.len());
35 println!("current_nodes={}", state.graph().await.nodes.len());
36 println!("added_nodes={:?}", diff.added_nodes);
37 Ok(())
38}pub fn generate() -> Self
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ForkId
impl<'de> Deserialize<'de> for ForkId
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 ForkId
Source§impl Ord for ForkId
impl Ord for ForkId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for ForkId
impl PartialOrd for ForkId
impl StructuralPartialEq for ForkId
Auto Trait Implementations§
impl Freeze for ForkId
impl RefUnwindSafe for ForkId
impl Send for ForkId
impl Sync for ForkId
impl Unpin for ForkId
impl UnsafeUnpin for ForkId
impl UnwindSafe for ForkId
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