TupleEncodingV1

Struct TupleEncodingV1 

Source
pub struct TupleEncodingV1<T>(pub T);
👎Deprecated: This type preserves a version of tuple encoding for backwards compatibility. It it is known to have improper key ordering. See https://github.com/khonsulabs/bonsaidb/issues/240.
Expand description

This type enables wrapping a tuple to preserve the behavior of the initial implementation of tuple key encoding. This type should not be used in new code and should only be used to preserve backwards compatibility. See https://github.com/khonsulabs/bonsaidb/issues/240 for more information about why this implementation should be avoided.

Tuple Fields§

§0: T
👎Deprecated: This type preserves a version of tuple encoding for backwards compatibility. It it is known to have improper key ordering. See https://github.com/khonsulabs/bonsaidb/issues/240.

Trait Implementations§

Source§

impl<T: Clone> Clone for TupleEncodingV1<T>

Source§

fn clone(&self) -> TupleEncodingV1<T>

Returns a duplicate 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<T: Debug> Debug for TupleEncodingV1<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'k, T1> Key<'k> for TupleEncodingV1<(T1,)>
where T1: for<'ke> Key<'ke>,

Source§

const CAN_OWN_BYTES: bool = false

If true, this type can benefit from an owned Vec<u8>. This flag is used as a hint of whether to attempt to do memcpy operations in some decoding operations to avoid extra allocations.
Source§

fn from_ord_bytes<'e>(bytes: ByteSource<'k, 'e>) -> Result<Self, Self::Error>

Deserialize a sequence of bytes previously encoded with KeyEncoding::as_ord_bytes.
Source§

fn first_value() -> Result<Self, NextValueError>

Return the first value in sequence for this type. Not all types implement this.
Source§

fn next_value(&self) -> Result<Self, NextValueError>

Return the next value in sequence for this type. Not all types implement this. Instead of wrapping/overflowing, None should be returned.
Source§

impl<'k, T1, T2> Key<'k> for TupleEncodingV1<(T1, T2)>
where T1: for<'ke> Key<'ke>, T2: for<'ke> Key<'ke>,

Source§

const CAN_OWN_BYTES: bool = false

If true, this type can benefit from an owned Vec<u8>. This flag is used as a hint of whether to attempt to do memcpy operations in some decoding operations to avoid extra allocations.
Source§

fn from_ord_bytes<'e>(bytes: ByteSource<'k, 'e>) -> Result<Self, Self::Error>

Deserialize a sequence of bytes previously encoded with KeyEncoding::as_ord_bytes.
Source§

fn first_value() -> Result<Self, NextValueError>

Return the first value in sequence for this type. Not all types implement this.
Source§

fn next_value(&self) -> Result<Self, NextValueError>

Return the next value in sequence for this type. Not all types implement this. Instead of wrapping/overflowing, None should be returned.
Source§

impl<'k, T1, T2, T3> Key<'k> for TupleEncodingV1<(T1, T2, T3)>
where T1: for<'ke> Key<'ke>, T2: for<'ke> Key<'ke>, T3: for<'ke> Key<'ke>,

Source§

const CAN_OWN_BYTES: bool = false

If true, this type can benefit from an owned Vec<u8>. This flag is used as a hint of whether to attempt to do memcpy operations in some decoding operations to avoid extra allocations.
Source§

fn from_ord_bytes<'e>(bytes: ByteSource<'k, 'e>) -> Result<Self, Self::Error>

Deserialize a sequence of bytes previously encoded with KeyEncoding::as_ord_bytes.
Source§

fn first_value() -> Result<Self, NextValueError>

Return the first value in sequence for this type. Not all types implement this.
Source§

fn next_value(&self) -> Result<Self, NextValueError>

Return the next value in sequence for this type. Not all types implement this. Instead of wrapping/overflowing, None should be returned.
Source§

impl<'k, T1, T2, T3, T4> Key<'k> for TupleEncodingV1<(T1, T2, T3, T4)>
where T1: for<'ke> Key<'ke>, T2: for<'ke> Key<'ke>, T3: for<'ke> Key<'ke>, T4: for<'ke> Key<'ke>,

Source§

const CAN_OWN_BYTES: bool = false

If true, this type can benefit from an owned Vec<u8>. This flag is used as a hint of whether to attempt to do memcpy operations in some decoding operations to avoid extra allocations.
Source§

fn from_ord_bytes<'e>(bytes: ByteSource<'k, 'e>) -> Result<Self, Self::Error>

Deserialize a sequence of bytes previously encoded with KeyEncoding::as_ord_bytes.
Source§

fn first_value() -> Result<Self, NextValueError>

Return the first value in sequence for this type. Not all types implement this.
Source§

fn next_value(&self) -> Result<Self, NextValueError>

Return the next value in sequence for this type. Not all types implement this. Instead of wrapping/overflowing, None should be returned.
Source§

impl<'k, T1, T2, T3, T4, T5> Key<'k> for TupleEncodingV1<(T1, T2, T3, T4, T5)>
where T1: for<'ke> Key<'ke>, T2: for<'ke> Key<'ke>, T3: for<'ke> Key<'ke>, T4: for<'ke> Key<'ke>, T5: for<'ke> Key<'ke>,

Source§

const CAN_OWN_BYTES: bool = false

If true, this type can benefit from an owned Vec<u8>. This flag is used as a hint of whether to attempt to do memcpy operations in some decoding operations to avoid extra allocations.
Source§

fn from_ord_bytes<'e>(bytes: ByteSource<'k, 'e>) -> Result<Self, Self::Error>

Deserialize a sequence of bytes previously encoded with KeyEncoding::as_ord_bytes.
Source§

fn first_value() -> Result<Self, NextValueError>

Return the first value in sequence for this type. Not all types implement this.
Source§

fn next_value(&self) -> Result<Self, NextValueError>

Return the next value in sequence for this type. Not all types implement this. Instead of wrapping/overflowing, None should be returned.
Source§

impl<'k, T1, T2, T3, T4, T5, T6> Key<'k> for TupleEncodingV1<(T1, T2, T3, T4, T5, T6)>
where T1: for<'ke> Key<'ke>, T2: for<'ke> Key<'ke>, T3: for<'ke> Key<'ke>, T4: for<'ke> Key<'ke>, T5: for<'ke> Key<'ke>, T6: for<'ke> Key<'ke>,

Source§

const CAN_OWN_BYTES: bool = false

If true, this type can benefit from an owned Vec<u8>. This flag is used as a hint of whether to attempt to do memcpy operations in some decoding operations to avoid extra allocations.
Source§

fn from_ord_bytes<'e>(bytes: ByteSource<'k, 'e>) -> Result<Self, Self::Error>

Deserialize a sequence of bytes previously encoded with KeyEncoding::as_ord_bytes.
Source§

fn first_value() -> Result<Self, NextValueError>

Return the first value in sequence for this type. Not all types implement this.
Source§

fn next_value(&self) -> Result<Self, NextValueError>

Return the next value in sequence for this type. Not all types implement this. Instead of wrapping/overflowing, None should be returned.
Source§

impl<'k, T1, T2, T3, T4, T5, T6, T7> Key<'k> for TupleEncodingV1<(T1, T2, T3, T4, T5, T6, T7)>
where T1: for<'ke> Key<'ke>, T2: for<'ke> Key<'ke>, T3: for<'ke> Key<'ke>, T4: for<'ke> Key<'ke>, T5: for<'ke> Key<'ke>, T6: for<'ke> Key<'ke>, T7: for<'ke> Key<'ke>,

Source§

const CAN_OWN_BYTES: bool = false

If true, this type can benefit from an owned Vec<u8>. This flag is used as a hint of whether to attempt to do memcpy operations in some decoding operations to avoid extra allocations.
Source§

fn from_ord_bytes<'e>(bytes: ByteSource<'k, 'e>) -> Result<Self, Self::Error>

Deserialize a sequence of bytes previously encoded with KeyEncoding::as_ord_bytes.
Source§

fn first_value() -> Result<Self, NextValueError>

Return the first value in sequence for this type. Not all types implement this.
Source§

fn next_value(&self) -> Result<Self, NextValueError>

Return the next value in sequence for this type. Not all types implement this. Instead of wrapping/overflowing, None should be returned.
Source§

impl<'k, T1, T2, T3, T4, T5, T6, T7, T8> Key<'k> for TupleEncodingV1<(T1, T2, T3, T4, T5, T6, T7, T8)>
where T1: for<'ke> Key<'ke>, T2: for<'ke> Key<'ke>, T3: for<'ke> Key<'ke>, T4: for<'ke> Key<'ke>, T5: for<'ke> Key<'ke>, T6: for<'ke> Key<'ke>, T7: for<'ke> Key<'ke>, T8: for<'ke> Key<'ke>,

Source§

const CAN_OWN_BYTES: bool = false

If true, this type can benefit from an owned Vec<u8>. This flag is used as a hint of whether to attempt to do memcpy operations in some decoding operations to avoid extra allocations.
Source§

fn from_ord_bytes<'e>(bytes: ByteSource<'k, 'e>) -> Result<Self, Self::Error>

Deserialize a sequence of bytes previously encoded with KeyEncoding::as_ord_bytes.
Source§

fn first_value() -> Result<Self, NextValueError>

Return the first value in sequence for this type. Not all types implement this.
Source§

fn next_value(&self) -> Result<Self, NextValueError>

Return the next value in sequence for this type. Not all types implement this. Instead of wrapping/overflowing, None should be returned.
Source§

impl<T1> KeyEncoding for TupleEncodingV1<(T1,)>
where T1: for<'k> Key<'k>,

Source§

const LENGTH: Option<usize>

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.
Source§

type Error = CompositeKeyError

The error type that can be produced by either serialization or deserialization.
Source§

fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor,

Describes this type by invoking functions on visitor describing the key being encoded. Read more
Source§

fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>

Convert self into a Cow<'_, [u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.
Source§

impl<T1, T2> KeyEncoding for TupleEncodingV1<(T1, T2)>
where T1: for<'k> Key<'k>, T2: for<'k> Key<'k>,

Source§

const LENGTH: Option<usize>

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.
Source§

type Error = CompositeKeyError

The error type that can be produced by either serialization or deserialization.
Source§

fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor,

Describes this type by invoking functions on visitor describing the key being encoded. Read more
Source§

fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>

Convert self into a Cow<'_, [u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.
Source§

impl<T1, T2, T3> KeyEncoding for TupleEncodingV1<(T1, T2, T3)>
where T1: for<'k> Key<'k>, T2: for<'k> Key<'k>, T3: for<'k> Key<'k>,

Source§

const LENGTH: Option<usize>

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.
Source§

type Error = CompositeKeyError

The error type that can be produced by either serialization or deserialization.
Source§

fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor,

Describes this type by invoking functions on visitor describing the key being encoded. Read more
Source§

fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>

Convert self into a Cow<'_, [u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.
Source§

impl<T1, T2, T3, T4> KeyEncoding for TupleEncodingV1<(T1, T2, T3, T4)>
where T1: for<'k> Key<'k>, T2: for<'k> Key<'k>, T3: for<'k> Key<'k>, T4: for<'k> Key<'k>,

Source§

const LENGTH: Option<usize>

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.
Source§

type Error = CompositeKeyError

The error type that can be produced by either serialization or deserialization.
Source§

fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor,

Describes this type by invoking functions on visitor describing the key being encoded. Read more
Source§

fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>

Convert self into a Cow<'_, [u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.
Source§

impl<T1, T2, T3, T4, T5> KeyEncoding for TupleEncodingV1<(T1, T2, T3, T4, T5)>
where T1: for<'k> Key<'k>, T2: for<'k> Key<'k>, T3: for<'k> Key<'k>, T4: for<'k> Key<'k>, T5: for<'k> Key<'k>,

Source§

const LENGTH: Option<usize>

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.
Source§

type Error = CompositeKeyError

The error type that can be produced by either serialization or deserialization.
Source§

fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor,

Describes this type by invoking functions on visitor describing the key being encoded. Read more
Source§

fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>

Convert self into a Cow<'_, [u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.
Source§

impl<T1, T2, T3, T4, T5, T6> KeyEncoding for TupleEncodingV1<(T1, T2, T3, T4, T5, T6)>
where T1: for<'k> Key<'k>, T2: for<'k> Key<'k>, T3: for<'k> Key<'k>, T4: for<'k> Key<'k>, T5: for<'k> Key<'k>, T6: for<'k> Key<'k>,

Source§

const LENGTH: Option<usize>

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.
Source§

type Error = CompositeKeyError

The error type that can be produced by either serialization or deserialization.
Source§

fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor,

Describes this type by invoking functions on visitor describing the key being encoded. Read more
Source§

fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>

Convert self into a Cow<'_, [u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.
Source§

impl<T1, T2, T3, T4, T5, T6, T7> KeyEncoding for TupleEncodingV1<(T1, T2, T3, T4, T5, T6, T7)>
where T1: for<'k> Key<'k>, T2: for<'k> Key<'k>, T3: for<'k> Key<'k>, T4: for<'k> Key<'k>, T5: for<'k> Key<'k>, T6: for<'k> Key<'k>, T7: for<'k> Key<'k>,

Source§

const LENGTH: Option<usize>

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.
Source§

type Error = CompositeKeyError

The error type that can be produced by either serialization or deserialization.
Source§

fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor,

Describes this type by invoking functions on visitor describing the key being encoded. Read more
Source§

fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>

Convert self into a Cow<'_, [u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.
Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8> KeyEncoding for TupleEncodingV1<(T1, T2, T3, T4, T5, T6, T7, T8)>
where T1: for<'k> Key<'k>, T2: for<'k> Key<'k>, T3: for<'k> Key<'k>, T4: for<'k> Key<'k>, T5: for<'k> Key<'k>, T6: for<'k> Key<'k>, T7: for<'k> Key<'k>, T8: for<'k> Key<'k>,

Source§

const LENGTH: Option<usize>

The size of the key, if constant. If this type doesn’t produce the same number of bytes for each value, this should be None.
Source§

type Error = CompositeKeyError

The error type that can be produced by either serialization or deserialization.
Source§

fn describe<Visitor>(visitor: &mut Visitor)
where Visitor: KeyVisitor,

Describes this type by invoking functions on visitor describing the key being encoded. Read more
Source§

fn as_ord_bytes(&self) -> Result<Cow<'_, [u8]>, Self::Error>

Convert self into a Cow<'_, [u8]> containing bytes that are able to be compared via memcmp in a way that is comptaible with its own Ord implementation.

Auto Trait Implementations§

§

impl<T> Freeze for TupleEncodingV1<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for TupleEncodingV1<T>
where T: RefUnwindSafe,

§

impl<T> Send for TupleEncodingV1<T>
where T: Send,

§

impl<T> Sync for TupleEncodingV1<T>
where T: Sync,

§

impl<T> Unpin for TupleEncodingV1<T>
where T: Unpin,

§

impl<T> UnwindSafe for TupleEncodingV1<T>
where T: UnwindSafe,

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.