pub enum MaybeEmpty<T>where
T: Emptiable,{
Empty,
Value(T),
}Expand description
A value that may be empty or not.
MaybeEmpty was introduced to help support the quirk described in Emptiable
for Rust types which can’t represent the empty, additional value.
This type can be both serialized and deserialized. When serializing,
MaybeEmpty::Empty will produce an empty value (0 bytes) for emptiable types.
When deserializing, an empty value will be represented as MaybeEmpty::Empty.
Variants§
Empty
Represents an empty value (0 bytes in the serialized form).
Value(T)
Represents a non-empty value.
Trait Implementations§
Source§impl<T> Clone for MaybeEmpty<T>
impl<T> Clone for MaybeEmpty<T>
Source§fn clone(&self) -> MaybeEmpty<T>
fn clone(&self) -> MaybeEmpty<T>
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<T> Debug for MaybeEmpty<T>
impl<T> Debug for MaybeEmpty<T>
Source§impl<'frame, 'metadata, T> DeserializeValue<'frame, 'metadata> for MaybeEmpty<T>where
T: DeserializeValue<'frame, 'metadata> + Emptiable,
impl<'frame, 'metadata, T> DeserializeValue<'frame, 'metadata> for MaybeEmpty<T>where
T: DeserializeValue<'frame, 'metadata> + Emptiable,
Source§fn type_check(typ: &ColumnType<'_>) -> Result<(), TypeCheckError>
fn type_check(typ: &ColumnType<'_>) -> Result<(), TypeCheckError>
Checks that the column type matches what this type expects.
Source§fn deserialize(
typ: &'metadata ColumnType<'metadata>,
v: Option<FrameSlice<'frame>>,
) -> Result<MaybeEmpty<T>, DeserializationError>
fn deserialize( typ: &'metadata ColumnType<'metadata>, v: Option<FrameSlice<'frame>>, ) -> Result<MaybeEmpty<T>, DeserializationError>
Deserialize a column value from given serialized representation. Read more
Source§impl<T> Hash for MaybeEmpty<T>
impl<T> Hash for MaybeEmpty<T>
Source§impl<T> Ord for MaybeEmpty<T>
impl<T> Ord for MaybeEmpty<T>
Source§fn cmp(&self, other: &MaybeEmpty<T>) -> Ordering
fn cmp(&self, other: &MaybeEmpty<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialEq for MaybeEmpty<T>
impl<T> PartialEq for MaybeEmpty<T>
Source§impl<T> PartialOrd for MaybeEmpty<T>where
T: PartialOrd + Emptiable,
impl<T> PartialOrd for MaybeEmpty<T>where
T: PartialOrd + Emptiable,
Source§impl<T> SerializeValue for MaybeEmpty<T>where
T: SerializeValue + Emptiable,
impl<T> SerializeValue for MaybeEmpty<T>where
T: SerializeValue + Emptiable,
Source§fn serialize<'b>(
&self,
typ: &ColumnType<'_>,
writer: CellWriter<'b>,
) -> Result<WrittenCellProof<'b>, SerializationError>
fn serialize<'b>( &self, typ: &ColumnType<'_>, writer: CellWriter<'b>, ) -> Result<WrittenCellProof<'b>, SerializationError>
Serializes the value to given CQL type. Read more
impl<T> Copy for MaybeEmpty<T>
impl<T> Eq for MaybeEmpty<T>
impl<T> StructuralPartialEq for MaybeEmpty<T>where
T: Emptiable,
Auto Trait Implementations§
impl<T> Freeze for MaybeEmpty<T>where
T: Freeze,
impl<T> RefUnwindSafe for MaybeEmpty<T>where
T: RefUnwindSafe,
impl<T> Send for MaybeEmpty<T>where
T: Send,
impl<T> Sync for MaybeEmpty<T>where
T: Sync,
impl<T> Unpin for MaybeEmpty<T>where
T: Unpin,
impl<T> UnsafeUnpin for MaybeEmpty<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for MaybeEmpty<T>where
T: UnwindSafe,
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.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 more