pub struct Port<CID, SID, CA, CS, CM>{ /* private fields */ }Expand description
The port is the struct that holds all your ships. Like the [View], you’ll only have one port in your app but as many ships as you want.
Again like the [View], the port is the orchestrator of your ships. It will send the forward to/from the ships and your app.
Implementations§
Source§impl<CID, SID, CA, CS, CM> Port<CID, SID, CA, CS, CM>
impl<CID, SID, CA, CS, CM> Port<CID, SID, CA, CS, CM>
Sourcepub fn register(
&mut self,
id: SID,
ship: BoxedShip<CID, CA, CS, CM>,
) -> Result<()>
pub fn register( &mut self, id: SID, ship: BoxedShip<CID, CA, CS, CM>, ) -> Result<()>
Add a new ship to the port
§Errors
PortError::ShipAlreadyRegisteredif that ship ID is already present in the port
Sourcepub fn unregister(&mut self, id: &SID) -> Result<()>
pub fn unregister(&mut self, id: &SID) -> Result<()>
Remove the ship with given id from the port
§Errors
PortError::ShipNotFoundif there is no ship with that id in the port
Sourcepub fn registered(&self, id: &SID) -> bool
pub fn registered(&self, id: &SID) -> bool
Check if the ship with given id is registered in the port
Trait Implementations§
Auto Trait Implementations§
impl<CID, SID, CA, CS, CM> !RefUnwindSafe for Port<CID, SID, CA, CS, CM>
impl<CID, SID, CA, CS, CM> !Send for Port<CID, SID, CA, CS, CM>
impl<CID, SID, CA, CS, CM> !Sync for Port<CID, SID, CA, CS, CM>
impl<CID, SID, CA, CS, CM> !UnwindSafe for Port<CID, SID, CA, CS, CM>
impl<CID, SID, CA, CS, CM> Freeze for Port<CID, SID, CA, CS, CM>
impl<CID, SID, CA, CS, CM> Unpin for Port<CID, SID, CA, CS, CM>
impl<CID, SID, CA, CS, CM> UnsafeUnpin for Port<CID, SID, CA, CS, CM>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more