pub struct Onboard { /* private fields */ }Expand description
Finding a server, connecting to it, and staying let in.
Implementations§
Source§impl Onboard
impl Onboard
Sourcepub fn seek(
find: impl FnOnce() -> Option<Server> + Send + 'static,
credentials: Arc<dyn Credentials>,
trust: Trust,
human_name: &'static str,
permissions: Permissions,
log_prefix: &'static str,
wake: impl Fn() + Send + Sync + 'static,
) -> Self
pub fn seek( find: impl FnOnce() -> Option<Server> + Send + 'static, credentials: Arc<dyn Credentials>, trust: Trust, human_name: &'static str, permissions: Permissions, log_prefix: &'static str, wake: impl Fn() + Send + Sync + 'static, ) -> Self
Starts looking for the server. Returns at once: find runs on a
thread of its own, because discovery can take several seconds and
a name lookup can hang.
credentials is where a token, this device’s own name and a
pending request are kept – see Credentials’s own doc.
human_name is what an administrator sees in the device list’s
own description column, e.g. "AIS target list". log_prefix
tags this application’s own log lines, e.g. "ais-list". wake
is passed to every Connection this opens – see
Connection::open for what it is for.
Sourcepub fn server(&self) -> Option<&Server>
pub fn server(&self) -> Option<&Server>
The server this run found, once discovery has answered.
Sourcepub fn trust(&self) -> &Trust
pub fn trust(&self) -> &Trust
The authority this run trusts – for a caller making its own REST calls (fetching display units, say) against the same server this opened its stream to, rather than reloading it from disk again.
Sourcepub fn stage(&self) -> Stage
pub fn stage(&self) -> Stage
Where this device stands. See Stage’s own doc for why this
stops answering Stage::Onboarding once the link has ever come
up.
Sourcepub fn poll(&mut self) -> Vec<Delta>
pub fn poll(&mut self) -> Vec<Delta>
Picks up whatever has arrived since last time, and returns every
delta read off the stream – own ship’s or another vessel’s, this
module does not look. Everything else the stream can say
(Event::Connected, Event::Disconnected,
Event::Unauthorized) is acted on here and never handed out;
see the module’s own doc for why.