pub struct Broker {
pub(crate) listener: TcpListener,
}Expand description
A TCP listener that hands out scripted MQTT connections.
Fields§
§listener: TcpListenerImplementations§
Source§impl Broker
impl Broker
Sourcepub async fn bind() -> Self
pub async fn bind() -> Self
Binds to an ephemeral IPv6 port.
Listening on [::] accepts IPv6 clients and, on the usual dual-stack
configuration, IPv4-mapped clients (e.g. 127.0.0.1) too. On a rare
IPv6-only host, clients simply connect over IPv6.
§Panics
Panics if binding fails.
Sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
The TCP port the fake broker is listening on.
§Panics
Panics if the listener’s local address cannot be queried.
Sourcepub fn host(&self) -> &'static str
pub fn host(&self) -> &'static str
The loopback host a client should connect to, matching the bound
address family. Pair it with port so test code never
has to assume IPv4 or dual-stack.
Auto Trait Implementations§
impl !Freeze for Broker
impl RefUnwindSafe for Broker
impl Send for Broker
impl Sync for Broker
impl Unpin for Broker
impl UnwindSafe for Broker
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