pub struct BinaryResponseBodyChunkEvent {
pub correlation_id: String,
pub data: Bytes,
pub is_last: bool,
pub total_size: Option<usize>,
pub chunk_index: u32,
pub bytes_sent: usize,
}Expand description
Binary response body chunk event.
This type uses Bytes for zero-copy body streaming, avoiding the base64
encode/decode overhead of ResponseBodyChunkEvent. Use this type for:
- Binary UDS transport (with
binary-udsfeature) - gRPC transport (protobuf already uses bytes)
- Any transport that supports raw binary data
For JSON transport, use ResponseBodyChunkEvent with base64-encoded data.
Fields§
§correlation_id: StringCorrelation ID
data: BytesBody chunk data (raw bytes, no encoding)
is_last: boolIs this the last chunk?
total_size: Option<usize>Total body size if known
chunk_index: u32Chunk index for ordering (0-based)
bytes_sent: usizeBytes sent so far (cumulative)
Implementations§
Source§impl BinaryResponseBodyChunkEvent
impl BinaryResponseBodyChunkEvent
Sourcepub fn new(
correlation_id: impl Into<String>,
data: impl Into<Bytes>,
chunk_index: u32,
is_last: bool,
) -> Self
pub fn new( correlation_id: impl Into<String>, data: impl Into<Bytes>, chunk_index: u32, is_last: bool, ) -> Self
Create a new binary response body chunk event.
Sourcepub fn with_total_size(self, size: usize) -> Self
pub fn with_total_size(self, size: usize) -> Self
Set the total body size.
Sourcepub fn with_bytes_sent(self, bytes: usize) -> Self
pub fn with_bytes_sent(self, bytes: usize) -> Self
Set cumulative bytes sent.
Trait Implementations§
Source§impl Clone for BinaryResponseBodyChunkEvent
impl Clone for BinaryResponseBodyChunkEvent
Source§fn clone(&self) -> BinaryResponseBodyChunkEvent
fn clone(&self) -> BinaryResponseBodyChunkEvent
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 moreSource§impl Debug for BinaryResponseBodyChunkEvent
impl Debug for BinaryResponseBodyChunkEvent
Source§impl From<&ResponseBodyChunkEvent> for BinaryResponseBodyChunkEvent
impl From<&ResponseBodyChunkEvent> for BinaryResponseBodyChunkEvent
Source§fn from(event: &ResponseBodyChunkEvent) -> Self
fn from(event: &ResponseBodyChunkEvent) -> Self
Convert base64-encoded body chunk to binary type.
If base64 decoding fails, falls back to treating data as raw UTF-8 bytes.
Source§impl From<BinaryResponseBodyChunkEvent> for ResponseBodyChunkEvent
impl From<BinaryResponseBodyChunkEvent> for ResponseBodyChunkEvent
Source§fn from(event: BinaryResponseBodyChunkEvent) -> Self
fn from(event: BinaryResponseBodyChunkEvent) -> Self
Convert binary body chunk to base64-encoded JSON-compatible type.
Auto Trait Implementations§
impl !Freeze for BinaryResponseBodyChunkEvent
impl RefUnwindSafe for BinaryResponseBodyChunkEvent
impl Send for BinaryResponseBodyChunkEvent
impl Sync for BinaryResponseBodyChunkEvent
impl Unpin for BinaryResponseBodyChunkEvent
impl UnwindSafe for BinaryResponseBodyChunkEvent
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