pub struct ProtoStateFieldDiffsWriter {
data_buf: BytesMut,
proto: ProtoStateFieldDiffs,
}
Expand description
A type that facilitates the proto encoding of a ProtoStateFieldDiffs
ProtoStateFieldDiffs
is a columnar encoding of StateFieldDiff
s, see
its doc comment for more info. The underlying buffer for a ProtoStateFieldDiffs
is a Bytes
struct, which is an immutable, shared, reference counted,
buffer of data. Using a Bytes
struct is a very efficient way to manage data
becuase multiple Bytes
can reference different parts of the same underlying
portion of memory. See its doc comment for more info.
A ProtoStateFieldDiffsWriter
maintains a mutable, unique, data buffer, i.e.
a BytesMut
, which we use when encoding a StateFieldDiff
. And when
finished encoding, we convert it into a ProtoStateFieldDiffs
by “freezing” the
underlying buffer, converting it into a Bytes
struct, so it can be shared.
Fields§
§data_buf: BytesMut
§proto: ProtoStateFieldDiffs
Implementations§
source§impl ProtoStateFieldDiffsWriter
impl ProtoStateFieldDiffsWriter
sourcepub fn push_field(&mut self, field: ProtoStateField)
pub fn push_field(&mut self, field: ProtoStateField)
Record a ProtoStateField
for our columnar encoding.
sourcepub fn push_diff_type(&mut self, diff_type: ProtoStateFieldDiffType)
pub fn push_diff_type(&mut self, diff_type: ProtoStateFieldDiffType)
Record a ProtoStateFieldDiffType
for our columnar encoding.
sourcepub fn encode_proto<M: Message>(&mut self, msg: &M)
pub fn encode_proto<M: Message>(&mut self, msg: &M)
Encode a message for our columnar encoding.
pub fn into_proto(self) -> ProtoStateFieldDiffs
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for ProtoStateFieldDiffsWriter
impl Send for ProtoStateFieldDiffsWriter
impl Sync for ProtoStateFieldDiffsWriter
impl Unpin for ProtoStateFieldDiffsWriter
impl UnwindSafe for ProtoStateFieldDiffsWriter
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
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
T
in a tonic::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.