Skip to main content

DispatchableNetwork

Struct DispatchableNetwork 

Source
pub struct DispatchableNetwork { /* private fields */ }
Expand description

A dispatchable network produced on the ground, ready to load into a Dispatcher.

Produced by Stn::dispatchable and Stnu::dispatchable. Point indices match the source network.

Implementations§

Source§

impl DispatchableNetwork

Source

pub fn points(&self) -> &[PointKind]

Kind of every time point.

Source

pub fn edges(&self) -> &[DispatchEdge]

Dispatchable edges.

Source

pub fn waits(&self) -> &[Wait]

Waits on contingent points.

Source

pub fn entry_count(&self) -> usize

Adjacency entries a Dispatcher needs: two per edge plus one per wait.

Source

pub fn dispatcher<const N: usize, const E: usize, I: Index>( &self, ) -> Result<Dispatcher<N, E, I>, DispatchError>

Loads this network into a new fixed-capacity dispatcher.

The index type I is usually inferred from the annotated result type, e.g. let d: Dispatcher<8, 64> = net.dispatcher()? (with the default usize) or Dispatcher<8, 64, u16>. To load into an existing dispatcher in place, use Dispatcher::load with Self::points, Self::edges and Self::waits.

§Errors

As for Dispatcher::load.

Source

pub fn encode(&self) -> Result<Vec<u8>, EncodeError>

Encodes this network in the compact checksummed format of encoding.

§Examples
use temporal_control::{Budget, Dispatcher, DispatchableNetwork, Stn, Ticks, Verdict};

let mut stn = Stn::new();
let a = stn.add_time_point().expect("fits");
let b = stn.add_time_point().expect("fits");
stn.add_constraint(a, b, Some(Ticks(5)), Some(Ticks(15))).expect("exists");
let Verdict::Consistent(net) = stn.dispatchable(&Budget::UNLIMITED).expect("fits") else {
    panic!("consistent");
};

let bytes = net.encode().expect("small");
assert_eq!(DispatchableNetwork::decode(&bytes), Ok(net));

let mut d = Dispatcher::<2, 8>::EMPTY;
d.load_encoded(&bytes).expect("valid");
§Errors

EncodeError::TooLarge if a count or index exceeds u32::MAX.

Source

pub fn decode(bytes: &[u8]) -> Result<Self, DecodeError>

Decodes and validates an encoding, for ground-side checks of what will be uplinked.

Accepts exactly the encodings that a dispatcher of unlimited capacity with usize indices accepts.

§Errors

As for Dispatcher::load_encoded, except that capacities never apply.

Trait Implementations§

Source§

impl Clone for DispatchableNetwork

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DispatchableNetwork

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for DispatchableNetwork

Source§

impl PartialEq for DispatchableNetwork

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DispatchableNetwork

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.