mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-08 22:38:01 -06:00
Support module-inferred leaf hosts
This commit is contained in:
@@ -18,11 +18,8 @@ struct EchoLeaf {
|
||||
prefix: String,
|
||||
}
|
||||
|
||||
leaf! {
|
||||
id = "org.example.v1.echo",
|
||||
endpoint_struct = EchoLeaf,
|
||||
procedures = ["echo"],
|
||||
}
|
||||
#[leaf(id = "org.example.v1.echo", endpoint_struct = EchoLeaf, procedures = ["echo"])]
|
||||
struct Echo;
|
||||
|
||||
#[derive(Archive, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
struct EchoRequest {
|
||||
|
||||
@@ -17,11 +17,8 @@ impl ProcedureMetadata for Reset {
|
||||
const PROCEDURE_SUFFIX: &'static str = "reset";
|
||||
}
|
||||
|
||||
leaf! {
|
||||
id = "org.example.v1.demo",
|
||||
procedures = [Open, Reset],
|
||||
endpoint_struct = EndpointHost,
|
||||
}
|
||||
#[leaf(id = "org.example.v1.demo", procedures = [Open, Reset], endpoint_struct = EndpointHost)]
|
||||
struct Demo;
|
||||
|
||||
struct EndpointHalf;
|
||||
struct TuiHalf;
|
||||
@@ -32,7 +29,7 @@ impl ProcedureMetadata for Connect {
|
||||
const PROCEDURE_SUFFIX: &'static str = "connect";
|
||||
}
|
||||
|
||||
leaf! {
|
||||
#[leaf(
|
||||
name = "chat",
|
||||
org = "org",
|
||||
product = "example",
|
||||
@@ -40,7 +37,8 @@ leaf! {
|
||||
procedures = [Connect],
|
||||
endpoint_struct = EndpointHalf,
|
||||
tui_struct = TuiHalf,
|
||||
}
|
||||
)]
|
||||
struct Chat;
|
||||
|
||||
struct TuiOnly;
|
||||
struct Tail;
|
||||
@@ -50,11 +48,8 @@ impl ProcedureMetadata for Tail {
|
||||
const PROCEDURE_SUFFIX: &'static str = "tail";
|
||||
}
|
||||
|
||||
leaf! {
|
||||
id = "org.example.v1.transcript",
|
||||
procedures = [Tail],
|
||||
tui_struct = TuiOnly,
|
||||
}
|
||||
#[leaf(id = "org.example.v1.transcript", procedures = [Tail], tui_struct = TuiOnly)]
|
||||
struct Transcript;
|
||||
|
||||
#[test]
|
||||
fn leaf_declaration_generates_endpoint_host_metadata() {
|
||||
|
||||
@@ -17,11 +17,8 @@ struct StreamLeaf {
|
||||
sessions: BTreeMap<HookKey, ProcedureOpen>,
|
||||
}
|
||||
|
||||
leaf! {
|
||||
id = "org.example.v1.stream",
|
||||
procedures = [ProcedureOpen],
|
||||
endpoint_struct = StreamLeaf,
|
||||
}
|
||||
#[leaf(id = "org.example.v1.stream", procedures = [ProcedureOpen], endpoint_struct = StreamLeaf)]
|
||||
struct Stream;
|
||||
|
||||
impl ProcedureStore<ProcedureOpen> for StreamLeaf {
|
||||
fn procedure_sessions(&mut self) -> &mut BTreeMap<HookKey, ProcedureOpen> {
|
||||
@@ -146,11 +143,8 @@ struct DuplexLeaf {
|
||||
sessions: BTreeMap<HookKey, DuplexProcedure>,
|
||||
}
|
||||
|
||||
leaf! {
|
||||
id = "org.example.v1.duplex",
|
||||
procedures = [DuplexProcedure],
|
||||
endpoint_struct = DuplexLeaf,
|
||||
}
|
||||
#[leaf(id = "org.example.v1.duplex", procedures = [DuplexProcedure], endpoint_struct = DuplexLeaf)]
|
||||
struct Duplex;
|
||||
|
||||
impl ProcedureStore<DuplexProcedure> for DuplexLeaf {
|
||||
fn procedure_sessions(&mut self) -> &mut BTreeMap<HookKey, DuplexProcedure> {
|
||||
|
||||
Reference in New Issue
Block a user