pub struct BinaryFrame {
pub msg_type: MessageType,
pub payload: Bytes,
}Expand description
Binary frame with header and payload.
Fields§
§msg_type: MessageType§payload: BytesImplementations§
Source§impl BinaryFrame
impl BinaryFrame
Sourcepub fn new(msg_type: MessageType, payload: impl Into<Bytes>) -> Self
pub fn new(msg_type: MessageType, payload: impl Into<Bytes>) -> Self
Create a new binary frame.
Sourcepub async fn decode<R: AsyncRead + Unpin>(
reader: &mut R,
) -> Result<Self, AgentProtocolError>
pub async fn decode<R: AsyncRead + Unpin>( reader: &mut R, ) -> Result<Self, AgentProtocolError>
Decode frame from reader.
Sourcepub async fn write<W: AsyncWrite + Unpin>(
&self,
writer: &mut W,
) -> Result<(), AgentProtocolError>
pub async fn write<W: AsyncWrite + Unpin>( &self, writer: &mut W, ) -> Result<(), AgentProtocolError>
Write frame to writer.
Trait Implementations§
Source§impl Clone for BinaryFrame
impl Clone for BinaryFrame
Source§fn clone(&self) -> BinaryFrame
fn clone(&self) -> BinaryFrame
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for BinaryFrame
impl RefUnwindSafe for BinaryFrame
impl Send for BinaryFrame
impl Sync for BinaryFrame
impl Unpin for BinaryFrame
impl UnwindSafe for BinaryFrame
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request