pub struct DatagramLocalEndpoint<US: AsyncDatagramSocket>{ /* private fields */ }
Expand description
Generic, datagram-based CoAP local endpoint implementation.
Implementations§
Source§impl<US: AsyncDatagramSocket> DatagramLocalEndpoint<US>
impl<US: AsyncDatagramSocket> DatagramLocalEndpoint<US>
Sourcepub fn new(socket: US) -> DatagramLocalEndpoint<US>
pub fn new(socket: US) -> DatagramLocalEndpoint<US>
Creates a new DatagramLocalEndpoint
instance with the given AsyncDatagramSocket
and the standard scheme (coap:
) and default port (5683).
Sourcepub fn with_scheme_and_port(
socket: US,
scheme: &'static str,
default_port: u16,
) -> DatagramLocalEndpoint<US>
pub fn with_scheme_and_port( socket: US, scheme: &'static str, default_port: u16, ) -> DatagramLocalEndpoint<US>
Creates a new DatagramLocalEndpoint
instance with the given AsyncDatagramSocket
,
using the specified scheme and default port.
Trait Implementations§
Source§impl<US: Debug + AsyncDatagramSocket> Debug for DatagramLocalEndpoint<US>
impl<US: Debug + AsyncDatagramSocket> Debug for DatagramLocalEndpoint<US>
Source§impl<US: AsyncDatagramSocket> LocalEndpoint for DatagramLocalEndpoint<US>
impl<US: AsyncDatagramSocket> LocalEndpoint for DatagramLocalEndpoint<US>
Source§type SocketAddr = <US as DatagramSocketTypes>::SocketAddr
type SocketAddr = <US as DatagramSocketTypes>::SocketAddr
The
SocketAddr
type to use with this local endpoint. This is usually
simply std::net::SocketAddr
, but may be different in some cases (like for CoAP-SMS
endpoints).Source§type SocketError = <US as DatagramSocketTypes>::Error
type SocketError = <US as DatagramSocketTypes>::Error
The error type associated with errors generated by socket and address-lookup operations.
Typically, this is
std::io::Error
, but it may be different if Self::SocketAddr
isn’t
std::net::SocketAddr
.Source§type DefaultTransParams = StandardCoapConstants
type DefaultTransParams = StandardCoapConstants
The trait representing the default transmission parameters to use.
Source§type LookupStream = Iter<IntoIter<<DatagramLocalEndpoint<US> as LocalEndpoint>::SocketAddr>>
type LookupStream = Iter<IntoIter<<DatagramLocalEndpoint<US> as LocalEndpoint>::SocketAddr>>
The concrete return type of the
lookup()
method.Source§type RespondableInboundContext = DatagramRespondableInboundContext<<DatagramLocalEndpoint<US> as LocalEndpoint>::SocketAddr>
type RespondableInboundContext = DatagramRespondableInboundContext<<DatagramLocalEndpoint<US> as LocalEndpoint>::SocketAddr>
Type used by closure that is passed into
receive()
, representing the context for
inbound requests.Source§type InboundContext = DatagramRespondableInboundContext<<DatagramLocalEndpoint<US> as LocalEndpoint>::SocketAddr>
type InboundContext = DatagramRespondableInboundContext<<DatagramLocalEndpoint<US> as LocalEndpoint>::SocketAddr>
Type used by closure that is passed into
send()
, representing the context for the
response.Source§type RemoteEndpoint = DatagramRemoteEndpoint<US>
type RemoteEndpoint = DatagramRemoteEndpoint<US>
The concrete type for a
RemoteEndpoint
associated with this local endpoint.Source§fn remote_endpoint<S, H, P>(
&self,
addr: S,
host: Option<H>,
path: P,
) -> Self::RemoteEndpointwhere
S: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::SocketError>,
H: Into<String>,
P: Into<RelRefBuf>,
fn remote_endpoint<S, H, P>(
&self,
addr: S,
host: Option<H>,
path: P,
) -> Self::RemoteEndpointwhere
S: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::SocketError>,
H: Into<String>,
P: Into<RelRefBuf>,
Constructs a new
RemoteEndpoint
instance for the given address, host, and path.Source§fn remote_endpoint_from_uri(
&self,
uri: &Uri,
) -> Result<Self::RemoteEndpoint, Error>
fn remote_endpoint_from_uri( &self, uri: &Uri, ) -> Result<Self::RemoteEndpoint, Error>
Constructs a new
RemoteEndpoint
instance for the given Uri.Source§fn send<'a, S, R, SD>(
&'a self,
dest: S,
send_desc: SD,
) -> BoxFuture<'a, Result<R, Error>>where
S: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::SocketError> + 'a,
SD: SendDesc<Self::InboundContext, R> + 'a,
R: Send + 'a,
fn send<'a, S, R, SD>(
&'a self,
dest: S,
send_desc: SD,
) -> BoxFuture<'a, Result<R, Error>>where
S: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::SocketError> + 'a,
SD: SendDesc<Self::InboundContext, R> + 'a,
R: Send + 'a,
Source§fn receive<'a, F>(&'a self, handler: F) -> BoxFuture<'a, Result<(), Error>>
fn receive<'a, F>(&'a self, handler: F) -> BoxFuture<'a, Result<(), Error>>
Receives a single request and runs the given
handler
on it once. Read moreSource§fn scheme(&self) -> &'static str
fn scheme(&self) -> &'static str
Returns a string representing the scheme of the underlying transport.
For example, this could return
"coap"
, "coaps+sms"
, etc.Source§fn default_port(&self) -> u16
fn default_port(&self) -> u16
Returns the default port to use when the port is unspecified. This value
is typically defined by the scheme. Returns zero if port numbers are ignored
by the underlying technology.
Auto Trait Implementations§
impl<US> Freeze for DatagramLocalEndpoint<US>
impl<US> RefUnwindSafe for DatagramLocalEndpoint<US>where
US: RefUnwindSafe,
impl<US> Send for DatagramLocalEndpoint<US>
impl<US> Sync for DatagramLocalEndpoint<US>
impl<US> Unpin for DatagramLocalEndpoint<US>
impl<US> UnwindSafe for DatagramLocalEndpoint<US>where
US: RefUnwindSafe,
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> LocalEndpointExt for Twhere
T: LocalEndpoint,
impl<T> LocalEndpointExt for Twhere
T: LocalEndpoint,
Source§fn send_as_stream<'a, S, R, SD>(
&'a self,
dest: S,
send_desc: SD,
) -> SendAsStream<'a, R>where
S: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::SocketError> + 'a,
SD: SendDesc<Self::InboundContext, R> + 'a,
R: Send + 'a,
fn send_as_stream<'a, S, R, SD>(
&'a self,
dest: S,
send_desc: SD,
) -> SendAsStream<'a, R>where
S: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::SocketError> + 'a,
SD: SendDesc<Self::InboundContext, R> + 'a,
R: Send + 'a,
Sends a message where multiple responses are expected, returned as a
SendAsStream
. Read moreSource§fn receive_as_stream<'a, F>(
&'a self,
handler: F,
) -> ReceiveAsStream<'a, Self, F>
fn receive_as_stream<'a, F>( &'a self, handler: F, ) -> ReceiveAsStream<'a, Self, F>
Version of
LocalEndpoint::receive
that handles more than one inbound message,
returning a crate::ReceiveAsStream
instead of a future. Read more