pub struct CoapConfig { /* private fields */ }Expand description
Connection settings for a CoapTransport.
Construct with CoapConfig::new and refine with the chained setters; every
field has a sensible default so only the server address is required.
Implementations§
Source§impl CoapConfig
impl CoapConfig
Sourcepub fn new(host: impl Into<String>, port: u16) -> Self
pub fn new(host: impl Into<String>, port: u16) -> Self
Creates a configuration pointing at the given CoAP server.
§Arguments
host- the server hostname or IP address.port- the server UDP port, conventionally5683for plaintext CoAP.
§Returns
A configuration that binds an ephemeral local port, uses confirmable delivery, waits two to three seconds for the first acknowledgment, and retransmits up to four times: RFC 7252’s defaults.
Sourcepub fn reliability(self, reliability: Reliability) -> Self
pub fn reliability(self, reliability: Reliability) -> Self
Sourcepub fn ack_timeout(self, timeout: Duration) -> Self
pub fn ack_timeout(self, timeout: Duration) -> Self
Sets how long to wait for the first acknowledgment of a confirmable request.
The first wait is drawn between this and one and a half times it, and each wait after it doubles, as RFC 7252 section 4.2 describes. Section 4.8.1 forbids setting it below the default two seconds on a network without congestion control; lower the retransmissions instead to give up sooner.
§Arguments
timeout- the initial acknowledgment timeout.
§Returns
The updated configuration, for chaining.
Sourcepub fn max_retransmits(self, count: u32) -> Self
pub fn max_retransmits(self, count: u32) -> Self
Trait Implementations§
Source§impl Clone for CoapConfig
impl Clone for CoapConfig
Source§fn clone(&self) -> CoapConfig
fn clone(&self) -> CoapConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more