Skip to main content

SwitchboardCore

Struct SwitchboardCore 

Source
pub struct SwitchboardCore<S: Solver = DefaultSolver> { /* private fields */ }
Expand description

In-memory state tracker for endpoints and intents.

Implementations§

Source§

impl<S> SwitchboardCore<S>
where S: Solver,

Source

pub fn new(solver: S) -> Self

Create a new core with the supplied solver.

Source

pub fn add_endpoint(&mut self, directions: EndpointDirections) -> EndpointId

Register a new endpoint and return its identifier.

Source

pub fn remove_endpoint(&mut self, endpoint_id: EndpointId)

Remove an endpoint and any intents referencing it.

Source

pub fn endpoints(&self) -> &HashMap<EndpointId, EndpointDirections>

Access the registered endpoints.

Source

pub fn intents(&self) -> &[Intent]

Access the registered intents.

Source

pub fn add_intent( &mut self, from: EndpointId, to: EndpointId, ) -> Result<(), SwitchboardError>

Add a new intent between endpoints.

Source

pub fn remove_intent(&mut self, from: EndpointId, to: EndpointId)

Remove a previously registered intent.

Source

pub fn solve(&self) -> Result<Solution, SwitchboardError>

Solve the current wiring plan.

Trait Implementations§

Source§

impl Default for SwitchboardCore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> Freeze for SwitchboardCore<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for SwitchboardCore<S>
where S: RefUnwindSafe,

§

impl<S> Send for SwitchboardCore<S>
where S: Send,

§

impl<S> Sync for SwitchboardCore<S>
where S: Sync,

§

impl<S> Unpin for SwitchboardCore<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for SwitchboardCore<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for SwitchboardCore<S>
where S: UnwindSafe,

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, 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.