AppBuilder

Struct AppBuilder 

Source
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>

Source

pub fn new() -> Self

Source

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.

Source

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.

See AppBuilder::discoverable.

Source

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.

Source

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.

See AppBuilder::block_transfer.

Source

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.

Source

pub fn resources(self, resources: Vec<ResourceBuilder<Endpoint>>) -> Self

Convenience method to add multiple resources at once.

Trait Implementations§

Source§

impl<Endpoint: Ord + Clone> Default for AppBuilder<Endpoint>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Endpoint: Debug + Clone + Ord + Eq + Hash + Send + 'static> IntoHandler<AppHandler<Endpoint>, Endpoint> for AppBuilder<Endpoint>

Source§

fn into_handler(self, mtu: Option<u32>) -> AppHandler<Endpoint>

Auto Trait Implementations§

§

impl<Endpoint> Freeze for AppBuilder<Endpoint>

§

impl<Endpoint> !RefUnwindSafe for AppBuilder<Endpoint>

§

impl<Endpoint> !Send for AppBuilder<Endpoint>

§

impl<Endpoint> !Sync for AppBuilder<Endpoint>

§

impl<Endpoint> Unpin for AppBuilder<Endpoint>

§

impl<Endpoint> !UnwindSafe for AppBuilder<Endpoint>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V