risingwave_common::types::cow

Enum DatumCow

source
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 borrowed DatumRef 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 owned Datum with potentially an allocation, which can be used to store in a struct without lifetime constraints.

Variantsยง

ยง

Borrowed(DatumRef<'a>)

ยง

Owned(Datum)

Implementationsยง

sourceยง

impl DatumCow<'_>

source

pub const NULL: DatumCow<'static> = _

Equivalent to DatumCow::Owned(Datum::None).

Trait Implementationsยง

sourceยง

impl<'a> Clone for DatumCow<'a>

sourceยง

fn clone(&self) -> DatumCow<'a>

Returns a copy of the value. Read more
1.0.0 ยท sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
sourceยง

impl<'a> Debug for DatumCow<'a>

sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
sourceยง

impl From<Option<ScalarImpl>> for DatumCow<'_>

sourceยง

fn from(datum: Datum) -> Self

Converts to this type from the input type.
sourceยง

impl<'a> From<Option<ScalarRefImpl<'a>>> for DatumCow<'a>

sourceยง

fn from(datum: DatumRef<'a>) -> Self

Converts to this type from the input type.
sourceยง

impl PartialEq for DatumCow<'_>

sourceยง

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท sourceยง

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
sourceยง

impl ToDatumRef for DatumCow<'_>

sourceยง

fn to_datum_ref(&self) -> DatumRef<'_>

Convert the datum to DatumRef.
sourceยง

impl ToOwnedDatum for DatumCow<'_>

sourceยง

fn to_owned_datum(self) -> Datum

Convert the datum to an owned Datum.
sourceยง

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> Any for T
where T: 'static + ?Sized,

sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
sourceยง

impl<T> CloneToUninit for T
where T: Clone,

sourceยง

unsafe fn clone_to_uninit(&self, dst: *mut T)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
sourceยง

impl<D> DatumToProtoExt for D
where D: ToDatumRef,

sourceยง

fn to_protobuf(&self) -> Datum

Convert the datum to the protobuf representation.
ยง

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

ยง

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
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

ยง

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
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

sourceยง

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
ยง

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

ยง

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
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

ยง

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
sourceยง

impl<T> From<T> for T

sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

ยง

impl<T> FromRef<T> for T
where T: Clone,

ยง

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
ยง

impl<T> FutureExt for T

ยง

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
ยง

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
ยง

impl<T> Instrument for T

ยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
ยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
sourceยง

impl<T> Instrument for T

sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

sourceยง

impl<T> IntoEither for T

sourceยง

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 more
sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
sourceยง

impl<T> IntoRequest<T> for T

sourceยง

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
ยง

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

sourceยง

fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

sourceยง

fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>

sourceยง

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

ยง

const ALIGN: usize = _

The alignment of pointer.
ยง

type Init = T

The type for initializers.
ยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
ยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
ยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
ยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
sourceยง

impl<T> Same for T

sourceยง

type Output = T

Should always be Self
sourceยง

impl<T> ToOwned for T
where T: Clone,

sourceยง

type Owned = T

The resulting type after obtaining ownership.
sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
ยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

ยง

fn vzip(self) -> V

ยง

impl<T> WithSubscriber for T

ยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
ยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
sourceยง

impl<T> WithSubscriber for T

sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
ยง

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

ยง

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

ยง

impl<T> DevConfig for T
where T: Send + Sync + 'static + Debug,

sourceยง

impl<T> LruValue for T
where T: Send + Sync,

ยง

impl<T> Value for T
where T: Send + Sync + 'static,