Skip to main content

Router

Struct Router 

Source
pub struct Router<N, G, A, C, const MTU: usize = 1024, const OUT: usize = 2048> { /* private fields */ }
Expand description

A SpacePacket router with per-direction output queues.

ISL directions (N/S/E/W) share link type N. The ground link has an independent type G since it may use a different physical layer. Both must implement Datalink so the router can split them into read/write halves for concurrent I/O.

The read() loop uses select_biased! to poll all 5 readers and all 5 writers concurrently, eliminating head-of-line blocking and deadlock.

Implementations§

Source§

impl<N, G, A, C, const MTU: usize, const OUT: usize> Router<N, G, A, C, MTU, OUT>
where N: Datalink, G: Datalink, A: RoutingAlgorithm, C: Clock,

Source

pub fn address(&self) -> Address

Returns this router’s own address.

Source

pub fn builder() -> RouterBuilder<N, G, A, C, MTU, OUT>

Creates a new router with directional links.

Trait Implementations§

Source§

impl<N, G, A, C, const MTU: usize, const OUT: usize> NetworkRead for Router<N, G, A, C, MTU, OUT>
where N: Datalink, G: Datalink, A: RoutingAlgorithm, C: Clock,

Source§

type Error = RouterError<<N as Datalink>::ReadError, <G as Datalink>::ReadError>

Error type for read operations.
Source§

async fn read(&mut self, buffer: &mut [u8]) -> Result<usize, Self::Error>

Reads a packet into the provided buffer, returning its length.
Source§

impl<N, G, A, C, const MTU: usize, const OUT: usize> NetworkWrite for Router<N, G, A, C, MTU, OUT>
where N: Datalink, G: Datalink, A: RoutingAlgorithm, C: Clock,

Source§

type Error = RouterError<<N as Datalink>::WriteError, <G as Datalink>::WriteError>

Error type for write operations.
Source§

async fn write(&mut self, data: &[u8]) -> Result<(), Self::Error>

Writes a packet to the network.

Auto Trait Implementations§

§

impl<N, G, A, C, const MTU: usize, const OUT: usize> Freeze for Router<N, G, A, C, MTU, OUT>
where A: Freeze, C: Freeze, N: Freeze, G: Freeze,

§

impl<N, G, A, C, const MTU: usize, const OUT: usize> RefUnwindSafe for Router<N, G, A, C, MTU, OUT>

§

impl<N, G, A, C, const MTU: usize, const OUT: usize> Send for Router<N, G, A, C, MTU, OUT>
where A: Send, C: Send, N: Send, G: Send,

§

impl<N, G, A, C, const MTU: usize, const OUT: usize> Sync for Router<N, G, A, C, MTU, OUT>
where A: Sync, C: Sync, N: Sync, G: Sync,

§

impl<N, G, A, C, const MTU: usize, const OUT: usize> Unpin for Router<N, G, A, C, MTU, OUT>
where A: Unpin, C: Unpin, N: Unpin, G: Unpin,

§

impl<N, G, A, C, const MTU: usize, const OUT: usize> UnsafeUnpin for Router<N, G, A, C, MTU, OUT>

§

impl<N, G, A, C, const MTU: usize, const OUT: usize> UnwindSafe for Router<N, G, A, C, MTU, OUT>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.