pub trait Port: MaybeNamed + MaybeLabeled {
// Required methods
fn id(&self) -> PortID;
fn state(&self) -> PortState;
// Provided methods
fn is_closed(&self) -> bool { ... }
fn is_open(&self) -> bool { ... }
fn is_connected(&self) -> bool { ... }
fn close(&mut self) -> PortResult<bool> { ... }
}
Expand description
The common interface for ports, whether for input or output.
Required Methods§
Provided Methods§
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Checks whether this port is currently connected.
Sourcefn close(&mut self) -> PortResult<bool>
fn close(&mut self) -> PortResult<bool>
Closes this port, 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.
Returns Ok(true)
if the port was successfully closed.
Returns Ok(false)
if the port was already closed.
Returns Err(PortError)
if an error occurs.