pub enum DatumCow<'a> {
Borrowed(DatumRef<'a>),
Owned(Datum),
}
Expand description
๐ฎ A borrowed DatumRef
or an owned Datum
.
We do not use std::borrow::Cow
because it requires the borrowed variant
to be a reference, whereas what we have is a DatumRef
with a lifetime.
ยงUsage
Generally, you donโt need to match on the variants of DatumCow
to access
the underlying datum. Instead, you canโฆ
-
call
to_datum_ref
to get a borrowedDatumRef
without any allocation, which can be used to append to an array builder or to encode into the storage representation, -
call
to_owned_datum
to get an ownedDatum
with potentially an allocation, which can be used to store in a struct without lifetime constraints.
Variantsยง
Implementationsยง
Trait Implementationsยง
sourceยงimpl ToDatumRef for DatumCow<'_>
impl ToDatumRef for DatumCow<'_>
sourceยงfn to_datum_ref(&self) -> DatumRef<'_>
fn to_datum_ref(&self) -> DatumRef<'_>
Convert the datum to
DatumRef
.sourceยงimpl ToOwnedDatum for DatumCow<'_>
impl ToOwnedDatum for DatumCow<'_>
sourceยงfn to_owned_datum(self) -> Datum
fn to_owned_datum(self) -> Datum
Convert the datum to an owned
Datum
.impl Eq for DatumCow<'_>
Auto Trait Implementationsยง
impl<'a> Freeze for DatumCow<'a>
impl<'a> RefUnwindSafe for DatumCow<'a>
impl<'a> Send for DatumCow<'a>
impl<'a> Sync for DatumCow<'a>
impl<'a> Unpin for DatumCow<'a>
impl<'a> UnwindSafe for DatumCow<'a>
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ยงunsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
๐ฌThis is a nightly-only experimental API. (
clone_to_uninit
)sourceยงimpl<D> DatumToProtoExt for Dwhere
D: ToDatumRef,
impl<D> DatumToProtoExt for Dwhere
D: ToDatumRef,
sourceยงfn to_protobuf(&self) -> Datum
fn to_protobuf(&self) -> Datum
Convert the datum to the protobuf representation.
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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.ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
ยงimpl<T> FutureExt for T
impl<T> FutureExt for T
ยงfn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
ยงfn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
ยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<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> IntoEither for T
impl<T> IntoEither for T
sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresourceยง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
ยงimpl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
sourceยงimpl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
sourceยงfn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
Equivalent to
RelabeledMetricVec::with_metric_level
.sourceยงfn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
Equivalent to
RelabeledMetricVec::with_metric_level_relabel_n
.sourceยงfn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
Equivalent to
RelabeledMetricVec::with_metric_level_relabel_n
with metric_level
set to
MetricLevel::Debug
and relabel_num
set to 1.