pub struct Node { /* private fields */ }Implementations§
Source§impl Node
impl Node
pub fn builder() -> NodeBuilder
pub fn name(&self) -> &str
pub fn kind(&self) -> &NodeKind
Sourcepub fn capabilities(&self) -> Capabilities
pub fn capabilities(&self) -> Capabilities
What this node offers, changeable while it is connected. See Capabilities.
pub async fn connect_over( &self, transport: impl Transport, ) -> Result<Connection, WireError>
Sourcepub async fn dial(
&self,
url: &str,
token: &str,
) -> Result<Connection, ConnectError>
Available on crate feature client only.
pub async fn dial( &self, url: &str, token: &str, ) -> Result<Connection, ConnectError>
client only.Open one connection and hand it back. Nothing is retried and nothing is kept up: when this connection closes it stays closed, and dialling again is the caller’s to decide.
Both halves of a dial can refuse — the HTTP upgrade and the protocol handshake — and both
report a WireError. They are classified in one place, by
From<WireError> for ConnectError, so the two halves cannot drift into disagreeing about
what a refusal means.
Sourcepub async fn connect(
&self,
url: &str,
token: impl AsRef<str>,
) -> Result<Link, ConnectError>
Available on crate feature client only.
pub async fn connect( &self, url: &str, token: impl AsRef<str>, ) -> Result<Link, ConnectError>
client only.Connect, and stay connected.
Returns once the first dial has settled: a refusal no retry can fix is this call’s error,
and anything else is the link’s problem — it backs off and dials again. The link ends when
Link::disconnect is called, when it is dropped, or when the server refuses this node.
The token is any bearer string: the NodeToken an account minted, or a znt_ read out of a
secret manager. Requiring a type here would make a caller who never touches the account
layer learn it just to name one.
pub async fn accept( &self, transport: impl Transport, options: AcceptOptions, ) -> Result<Connection, WireError>
Auto Trait Implementations§
impl !RefUnwindSafe for Node
impl !UnwindSafe for Node
impl Freeze for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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