pub struct Frame {
pub message_type: MessageType,
pub payload: Bytes,
}Expand description
A framed message with type and payload
Fields§
§message_type: MessageType§payload: BytesImplementations§
Source§impl Frame
impl Frame
Sourcepub fn stream_data<M: Message>(msg: &M) -> Result<Self, FrameError>
pub fn stream_data<M: Message>(msg: &M) -> Result<Self, FrameError>
Create a new stream data frame
Sourcepub fn new<M: Message>(
message_type: MessageType,
msg: &M,
) -> Result<Self, FrameError>
pub fn new<M: Message>( message_type: MessageType, msg: &M, ) -> Result<Self, FrameError>
Create a new frame with the given type and message
Sourcepub fn decode<M: Message + Default>(&self) -> Result<M, FrameError>
pub fn decode<M: Message + Default>(&self) -> Result<M, FrameError>
Decode the payload as a protobuf message
Sourcepub fn decode_from_bytes(bytes: Bytes) -> Result<Self, FrameError>
pub fn decode_from_bytes(bytes: Bytes) -> Result<Self, FrameError>
Decode a frame from bytes
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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