pub struct XdcFrame {
pub payload: Vec<u8>,
pub from: XdcPeer,
pub direct: bool,
}Expand description
One frame an app (or another bot) sent on the channel.
Fields§
§payload: Vec<u8>§from: XdcPeer§direct: boolThe frame came straight from from.node over that node’s own
authenticated connection. Otherwise it was relayed, and the sender named
in its trailer is the sender’s claim.
Implementations§
Source§impl XdcFrame
impl XdcFrame
Sourcepub fn json<T: DeserializeOwned>(&self) -> Option<T>
pub fn json<T: DeserializeOwned>(&self) -> Option<T>
The payload parsed as JSON, the encoding nearly every app uses
(channel.send(new TextEncoder().encode(JSON.stringify(msg)))).
Sourcepub fn verified_sender(&self) -> Option<&str>
pub fn verified_sender(&self) -> Option<&str>
The sender’s npub, when you can act on it: the frame came straight from the sender’s device, and only one account in this chat has claimed that device. Use it for anything someone could fake (a move, a vote).
None when another player passed the frame on, or its sender isn’t
known. A device counts as the first account in the chat to announce it.
Trait Implementations§
Auto Trait Implementations§
impl Forget for XdcFrame
impl Freeze for XdcFrame
impl Move for XdcFrame
impl RefUnwindSafe for XdcFrame
impl Send for XdcFrame
impl Sync for XdcFrame
impl Unpin for XdcFrame
impl UnsafeUnpin for XdcFrame
impl UnwindSafe for XdcFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more