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§
Sourcefn close(&mut self)
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.
Sourcefn direction(&self) -> PortDirection
fn direction(&self) -> PortDirection
The dataflow direction of this port.
Provided Methods§
Sourcefn is_unconnected(&self) -> bool
fn is_unconnected(&self) -> bool
Checks whether this port is currently unconnected.
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Checks whether this port is currently connected.
Sourcefn is_disconnected(&self) -> bool
fn is_disconnected(&self) -> bool
Checks whether this port is currently disconnected.
Sourcefn max_capacity(&self) -> Option<usize>
fn max_capacity(&self) -> Option<usize>
Returns the maximum buffer capacity of the connection.