pub struct AppBuilder<Endpoint: Ord + Clone> { /* private fields */ }Expand description
Main builder API to configure how the CoAP server should respond to requests
Implementations§
Source§impl<Endpoint: Ord + Clone> AppBuilder<Endpoint>
impl<Endpoint: Ord + Clone> AppBuilder<Endpoint>
pub fn new() -> Self
Sourcepub fn discoverable(self) -> Self
pub fn discoverable(self) -> Self
Enable resource discovery by default for all resources in the app. To disable this
on a per-resource level, see ResourceBuilder::not_discoverable.
For more information refer to RFC 5785.
Sourcepub fn not_discoverable(self) -> Self
pub fn not_discoverable(self) -> Self
Disable resource discovery by default for all resources in the app. This can be overridden on a per-resource level.
Sourcepub fn block_transfer(self) -> Self
pub fn block_transfer(self) -> Self
Enable block-wise transfer by default for all resources in the app.
Block-wise transfer is defaulted to a transparent handler that buffers in memory large requests or responses as they are being transferred from/to the peer, expiring after some time if the client does not gracefully exhaust the payload (e.g. if the client downloads only a portion of a large response then goes away).
To disable this completely on a per-resource level, see
ResourceBuilder::disable_block_transfer. Alternatively you may implement a request
handler that responds with Block2 option values that will cause the transparent handler to
defer the handling to your custom logic.
For more information refer to RFC 7959.
Sourcepub fn disable_block_transfer(self) -> Self
pub fn disable_block_transfer(self) -> Self
Disable block-wise transfer by default for all resources in the app. This can be overriden on a per-resource level.
Sourcepub fn resource(self, resource: ResourceBuilder<Endpoint>) -> Self
pub fn resource(self, resource: ResourceBuilder<Endpoint>) -> Self
Add a resource handler to the app by the configured path. See crate::app::resource
to start building one.
Sourcepub fn resources(self, resources: Vec<ResourceBuilder<Endpoint>>) -> Self
pub fn resources(self, resources: Vec<ResourceBuilder<Endpoint>>) -> Self
Convenience method to add multiple resources at once.