pub struct AlignedMessageBuf { /* private fields */ }Expand description
An owned gRPC message whose payload starts at an eight-byte-aligned address.
Three private padding bytes precede the five-byte gRPC header. Only
Self::wire_bytes should be transmitted; the padding never goes on the wire.
Alignment applies to the encoded payload, including compressed payloads.
Implementations§
Source§impl AlignedMessageBuf
impl AlignedMessageBuf
Sourcepub fn new(payload: &[u8], compressed: bool) -> Result<Self, Status>
pub fn new(payload: &[u8], compressed: bool) -> Result<Self, Status>
Copies a payload into aligned storage and constructs its wire prefix.
§Errors
Returns resource exhausted if the payload exceeds the wire length limit or storage cannot be allocated.
Sourcepub fn payload_mut(&mut self) -> &mut [u8] ⓘ
pub fn payload_mut(&mut self) -> &mut [u8] ⓘ
Returns the aligned payload for in-place processing without changing its length.
Sourcepub fn wire_bytes(&self) -> &[u8] ⓘ
pub fn wire_bytes(&self) -> &[u8] ⓘ
Returns precisely the five-byte header followed by the payload.
Sourcepub fn is_compressed(&self) -> bool
pub fn is_compressed(&self) -> bool
Whether the gRPC compressed flag is set; decompression is a separate step.
Trait Implementations§
Source§impl Clone for AlignedMessageBuf
impl Clone for AlignedMessageBuf
Auto Trait Implementations§
impl Freeze for AlignedMessageBuf
impl RefUnwindSafe for AlignedMessageBuf
impl Send for AlignedMessageBuf
impl Sync for AlignedMessageBuf
impl Unpin for AlignedMessageBuf
impl UnsafeUnpin for AlignedMessageBuf
impl UnwindSafe for AlignedMessageBuf
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