Skip to main content

CadetMessage

Struct CadetMessage 

Source
pub struct CadetMessage {
    pub peer: PeerId,
    pub message_type: MessageType,
    pub payload: Vec<u8>,
    /* private fields */
}
Expand description

Входящее сообщение.

Пока значение существует, CADET не доставит в этот канал следующее сообщение: так получатель управляет потоком. Сообщение подтверждается при уничтожении значения или вызовом receive_done, но не более одного раза.

Fields§

§peer: PeerId

Узел на другом конце канала.

§message_type: MessageType

Тип сообщения.

§payload: Vec<u8>

Тело сообщения без заголовка GNUnet.

Implementations§

Source§

impl CadetMessage

Source

pub fn receive_done(&self)

Подтверждает сообщение, не дожидаясь уничтожения значения.

Source

pub async fn reply_accepted(&self, payload: &[u8]) -> Result<(), CadetError>

Отправляет в тот же канал ответ того же типа. Возвращается, когда ответ принят в локальную очередь канала.

Trait Implementations§

Source§

impl Drop for CadetMessage

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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.