Struct WriteEvent

Source
pub struct WriteEvent<'stack, 'server, P: PacketPool> { /* private fields */ }
Expand description

A characteristic write event returned while processing GATT requests.

Implementations§

Source§

impl<'stack, P: PacketPool> WriteEvent<'stack, '_, P>

Source

pub fn handle(&self) -> u16

Characteristic handle that was written

Source

pub fn data(&self) -> &[u8]

Raw data to be written

Source

pub fn value<T: FromGatt>( &self, _c: &Characteristic<T>, ) -> Result<T, FromGattError>

Characteristic data to be written

Source

pub fn accept(self) -> Result<Reply<'stack, P>, Error>

Accept the event, making it processed by the server.

Automatically called if drop() is invoked.

Source

pub fn reject(self, err: AttErrorCode) -> Result<Reply<'stack, P>, Error>

Reject the event with the provided error code, it will not be processed by the attribute server.

Source

pub fn payload(&self) -> &GattData<'stack, P>

Get a reference to the underlying GattData payload that this event is enclosing

Source

pub fn into_payload(self) -> GattData<'stack, P>

Convert the event back into the GattData payload it is enclosing

Allows for custom processing of the enclosed data, as in handling payloads which are not supported yet by the enclosed attribute server. Note that this will consume the event, so it would be up to the caller to respond to the incoming payload if needed and however they see fit.

Trait Implementations§

Source§

impl<P: PacketPool> Drop for WriteEvent<'_, '_, P>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'stack, 'server, P> Freeze for WriteEvent<'stack, 'server, P>
where <P as PacketPool>::Packet: Freeze,

§

impl<'stack, 'server, P> !RefUnwindSafe for WriteEvent<'stack, 'server, P>

§

impl<'stack, 'server, P> !Send for WriteEvent<'stack, 'server, P>

§

impl<'stack, 'server, P> !Sync for WriteEvent<'stack, 'server, P>

§

impl<'stack, 'server, P> Unpin for WriteEvent<'stack, 'server, P>
where <P as PacketPool>::Packet: Unpin,

§

impl<'stack, 'server, P> !UnwindSafe for WriteEvent<'stack, 'server, P>

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.