Port

Trait Port 

Source
pub trait Port<T: Send>: MaybeNamed + MaybeLabeled {
    // Required methods
    fn close(&mut self);
    fn direction(&self) -> PortDirection;
    fn state(&self) -> PortState;

    // Provided methods
    fn is_input(&self) -> bool { ... }
    fn is_output(&self) -> bool { ... }
    fn is_unconnected(&self) -> bool { ... }
    fn is_connected(&self) -> bool { ... }
    fn is_disconnected(&self) -> bool { ... }
    fn is_closed(&self) -> bool { ... }
    fn capacity(&self) -> Option<usize> { ... }
    fn max_capacity(&self) -> Option<usize> { ... }
}
Expand description

The common interface for ports, whether for input or output.

Required Methods§

Source

fn close(&mut self)

Closes this port without dropping it, returning immediately.

If the port had an open connection, it will be disconnected. If the port was already closed, no further action is taken. There is no facility to reopen a port once it has been closed.

Source

fn direction(&self) -> PortDirection

The dataflow direction of this port.

Source

fn state(&self) -> PortState

The current state of this port.

Provided Methods§

Source

fn is_input(&self) -> bool

Checks whether this port is an input port.

Source

fn is_output(&self) -> bool

Checks whether this port is an output port.

Source

fn is_unconnected(&self) -> bool

Checks whether this port is currently unconnected.

Source

fn is_connected(&self) -> bool

Checks whether this port is currently connected.

Source

fn is_disconnected(&self) -> bool

Checks whether this port is currently disconnected.

Source

fn is_closed(&self) -> bool

Checks whether this port is currently closed.

Source

fn capacity(&self) -> Option<usize>

Returns the remaining buffer capacity of the connection.

Source

fn max_capacity(&self) -> Option<usize>

Returns the maximum buffer capacity of the connection.

Trait Implementations§

Source§

impl<T: Send> Debug for &dyn Port<T>

Source§

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

Formats the value using the given formatter. Read more

Implementors§

Source§

impl<T: Send, const N: usize> Port<T> for Inputs<T, N>

Source§

impl<T: Send, const N: usize> Port<T> for Outputs<T, N>