pub struct GrpcFrame { /* private fields */ }Expand description
Decoded 5-byte length-prefixed gRPC message frame.
Implementations§
Source§impl GrpcFrame
Inherent implementation of GrpcFrame.
impl GrpcFrame
Inherent implementation of GrpcFrame.
Sourcepub fn encode_into(
&self,
encoding: Compress,
out: &mut Vec<u8>,
) -> Result<(), GrpcError>
pub fn encode_into( &self, encoding: Compress, out: &mut Vec<u8>, ) -> Result<(), GrpcError>
Encodes this frame directly into out in the 5-byte gRPC Length-Prefixed-Message wire format.
§Arguments
Compress- Compression coding to apply (Compress::Unknownsends uncompressed).&mut Vec<u8>- Destination wire buffer (appended to).
§Returns
Result<(), GrpcError>-Ok(())on success, orGrpcStatus::ResourceExhaustedon length overflow.
Sourcepub fn encode(&self, encoding: Compress) -> Result<Vec<u8>, GrpcError>
pub fn encode(&self, encoding: Compress) -> Result<Vec<u8>, GrpcError>
Encodes this frame into the 5-byte gRPC Length-Prefixed-Message wire format.
§Arguments
Compress- Compression coding to apply (Compress::Unknownsends uncompressed).
§Returns
Result<Vec<u8>, GrpcError>- Wire bytes, orGrpcStatus::ResourceExhaustedon length overflow.
Sourcepub fn decode(
raw: &[u8],
encoding: Compress,
max_message_size: usize,
) -> Result<Self, GrpcError>
pub fn decode( raw: &[u8], encoding: Compress, max_message_size: usize, ) -> Result<Self, GrpcError>
Decodes one 5-byte length-prefixed gRPC wire frame enforcing max_message_size and decompression caps.
§Arguments
&[u8]- Raw HTTP/2 request body bytes.Compress- Negotiatedgrpc-encodingcoding (Compress::Unknownfor identity).usize- Maximum allowed encoded and decoded payload length.
§Returns
Result<Self, GrpcError>- Decoded frame or canonicalGrpcError.
Sourcepub fn decode_many(
raw: &[u8],
encoding: Compress,
max_message_size: usize,
max_frames: usize,
) -> Result<Vec<Self>, GrpcError>
pub fn decode_many( raw: &[u8], encoding: Compress, max_message_size: usize, max_frames: usize, ) -> Result<Vec<Self>, GrpcError>
Decodes a sequence of concatenated gRPC frames up to max_frames for streaming batches.
§Arguments
&[u8]- Raw HTTP/2 body containing zero or more length-prefixed frames.Compress- Negotiatedgrpc-encodingcoding.usize- Maximum allowed per-frame size in bytes.usize- Maximum number of frames permitted to prevent DoS fan-out.
§Returns
Result<Vec<Self>, GrpcError>- Decoded frames in wire order.
Source§impl GrpcFrame
impl GrpcFrame
pub fn get_compressed(&self) -> bool
pub fn get_mut_compressed(&mut self) -> &mut bool
pub fn set_compressed(&mut self, val: bool) -> &mut Self
pub fn get_payload(&self) -> &Vec<u8> ⓘ
pub fn get_mut_payload(&mut self) -> &mut Vec<u8> ⓘ
pub fn set_payload(&mut self, val: Vec<u8>) -> &mut Self
Trait Implementations§
impl Eq for GrpcFrame
impl StructuralPartialEq for GrpcFrame
Auto Trait Implementations§
impl Forget for GrpcFrame
impl Freeze for GrpcFrame
impl Move for GrpcFrame
impl RefUnwindSafe for GrpcFrame
impl Send for GrpcFramewhere
RawVecInner: Send,
impl Sync for GrpcFramewhere
RawVecInner: Sync,
impl Unpin for GrpcFrame
impl UnsafeUnpin for GrpcFrame
impl UnwindSafe for GrpcFramewhere
RawVecInner: UnwindSafe,
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.