Skip to main content

FixedType

Struct FixedType 

Source
pub struct FixedType { /* private fields */ }
Expand description

A fixed-width scalar type, named without a value: what an absent value of that type stands in for.

AES-GCM keeps the plaintext’s length, so a plain null leaf (one byte) sealed in place of a date (five) shows which values are absent to anyone who can see the ciphertexts. A null of a FixedType is sealed as a typed null padded to the type’s own leaf length, so a sealed None and a sealed Some are the same length. See Sink::typed_null and tags::TYPED_NULL.

A FixedType is normalised to how its leaf is written, so two are equal exactly when their typed nulls are the same bytes. A logical type with a tag of its own fixes its width: a date is written as an i32 day count and a nanosecond timestamp and a decimal as 128-bit words, whatever width the value came with. A decimal’s scale travels inside its payload rather than in its tag, so every decimal has the one typed null, of scale 0.

Implementations§

Source§

impl FixedType

Source

pub const fn plain(width: Width) -> Option<Self>

A plain int or float, with no logical type, or None for Width::Bytes16: plain bytes are variable width.

Source

pub const fn new(ty: Option<Logical>, width: Width) -> Option<Self>

ty over width, normalised, or None if the pair has no fixed width: undefined (over null), a date, timestamp or decimal over a float, a uuid over anything but sixteen bytes, and sixteen bytes under anything but a uuid (plain or unknown bytes are variable width, so a reader could not tell where their typed null ends).

Source

pub fn of(ty: Option<Logical>, v: &Physical<'_>) -> Option<Self>

The type of v under ty, or None if it has none (see new): what a host that knows the value’s type but holds no value passes to Sink::typed_null.

Source

pub const fn logical(self) -> Option<Logical>

The logical type, if any.

Source

pub const fn width(self) -> Width

The physical width.

Trait Implementations§

Source§

impl Clone for FixedType

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for FixedType

Source§

impl Debug for FixedType

Source§

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

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

impl Eq for FixedType

Source§

impl PartialEq for FixedType

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FixedType

Auto Trait Implementations§

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.