Skip to main content

ControllerTask

Struct ControllerTask 

Source
pub struct ControllerTask { /* private fields */ }
Expand description

The driver, the rumqttc event loop and the command executor, as one future.

Implementations§

Source§

impl ControllerTask

Source

pub fn reresolve(self, f: Reresolve) -> Self

Looks the broker up again while its address may have changed: after the first failed connect since the task started or since the last successful connect, and after every third failed connect after that, the connection calls f, and options it returns replace the event loop’s before the next attempt. They keep the inflight cap and manual-ack setting of the options the task was built with. f returning None keeps the current options. Calls start with the first connect, so a broker that got a new address while the host was off is found at it. A host that found its broker over mDNS returns the same broker at its new address; one connected by a host name, or to a configured broker, needs no hook.

Source

pub async fn run(self) -> Result<(), Error>

Runs until ControllerHandle::shutdown: the driver; an EventLoop::poll loop that feeds the inbox and reconnects with a 1-30 s backoff; and a command executor, separate so a full request channel cannot deadlock against poll. After the shutdown’s UNSUBSCRIBE the executor sends a DISCONNECT, and the task ends once it is written, or at once when the link is down, discarding the commands not yet written. The future is Send.

The three run in one task. The driver yields between batches of received messages, so a backlog does not starve the event loop.

Trait Implementations§

Source§

impl Debug for ControllerTask

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.