2026-04-26 12:39:06 -06:00
|
|
|
#![no_std]
|
|
|
|
|
|
2026-05-28 11:48:46 -06:00
|
|
|
extern crate alloc;
|
2026-04-26 12:39:06 -06:00
|
|
|
|
2026-05-28 12:41:32 -06:00
|
|
|
mod endpoint;
|
|
|
|
|
mod error;
|
|
|
|
|
mod packet;
|
|
|
|
|
|
|
|
|
|
pub use endpoint::Endpoint;
|
|
|
|
|
pub use error::*;
|
|
|
|
|
pub use packet::Packet;
|
|
|
|
|
|
|
|
|
|
pub trait Leaf {
|
|
|
|
|
// Identifier for this leaf
|
|
|
|
|
fn get_id(&self) -> u32;
|
|
|
|
|
|
|
|
|
|
// Gets called every program loop
|
|
|
|
|
fn update(&mut self, _: &mut Endpoint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Various named types used for brevity
|
|
|
|
|
use alloc::{
|
|
|
|
|
collections::{btree_map::BTreeMap, btree_set::BTreeSet, vec_deque::VecDeque},
|
|
|
|
|
vec::Vec,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type Path = Vec<u32>;
|
|
|
|
|
type EndpointName = u32;
|
|
|
|
|
type HookID = u16;
|
|
|
|
|
type ConnectionSet = BTreeSet<(EndpointName, bool)>;
|
|
|
|
|
type HookMap = BTreeMap<HookID, EndpointName>;
|
|
|
|
|
type PacketQueue = VecDeque<Packet>;
|
|
|
|
|
type RouteMap = BTreeMap<EndpointName, PacketQueue>;
|
2026-05-27 11:04:22 -06:00
|
|
|
|
|
|
|
|
#[cfg(test)]
|
2026-05-28 12:41:32 -06:00
|
|
|
mod tests {
|
|
|
|
|
mod oneshot;
|
|
|
|
|
mod packet;
|
|
|
|
|
}
|