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_refto get a borrowedDatumRefwithout any allocation, which can be used to append to an array builder or to encode into the storage representation, -
call
to_owned_datumto get an ownedDatumwith 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ยง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<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
ยงfn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any.ยงfn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any.ยง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<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.ยงimpl<T> Pointable for T
impl<T> Pointable for T
ยงimpl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Sourceยงimpl<T> SameOrElseExt for Twhere
T: Eq,
impl<T> SameOrElseExt for Twhere
T: Eq,
Sourceยงfn same_or_else(self, other: T, f: impl FnOnce() -> T) -> T
fn same_or_else(self, other: T, f: impl FnOnce() -> T) -> T
Check if
self and other are equal, if so, return self, otherwise return the result of f().