Simplify endpoint outcome state handling

This commit is contained in:
Michael Mikovsky
2026-04-25 20:47:37 -06:00
parent f2c6a54060
commit 31a0bd39b0
19 changed files with 234 additions and 192 deletions
+5 -4
View File
@@ -2,8 +2,9 @@ use std::error::Error;
use std::{convert::Infallible, string::String};
use rkyv::{Archive, Deserialize, Serialize};
use unshell::protocol::tree::{Call, CallLeaf, Ingress, LeafRuntime, ProtocolEndpoint};
use unshell::protocol::tree::{ChildRoute, ConnectionState};
use unshell::protocol::tree::{
Call, CallLeaf, ChildRoute, EndpointOutcome, Ingress, LeafRuntime, ProtocolEndpoint,
};
use unshell::protocol::{PacketType, decode_frame};
use unshell::{Leaf, procedures};
@@ -60,7 +61,7 @@ fn main() -> Result<(), Box<dyn Error>> {
None,
vec![ChildRoute {
path: path(&["agent"]),
state: ConnectionState::Registered,
registered: true,
}],
Vec::new(),
);
@@ -74,7 +75,7 @@ fn main() -> Result<(), Box<dyn Error>> {
text: String::from("hello leaf"),
})?,
)?;
let Some((_, frame)) = controller_outcome.forward else {
let EndpointOutcome::Forward { frame, .. } = controller_outcome else {
return Err("expected controller to forward call".into());
};