#[repr(u8)]pub enum FloatWidth {
F32 = 0,
F64 = 1,
}Expand description
The declared width of a floating-point column.
Ordered narrow → wide; F64 is the storage width and the default for a
float column whose declared type carries no width information.
Variants§
F32 = 0
REAL / FLOAT4 / FLOAT32 / FLOAT(p<=24) — 4 bytes on the wire,
PostgreSQL OID 700.
F64 = 1
DOUBLE PRECISION / FLOAT8 / FLOAT64 / FLOAT / FLOAT(p>=25) —
8 bytes on the wire, PostgreSQL OID 701.
Implementations§
Source§impl FloatWidth
impl FloatWidth
Sourcepub fn from_declared_type(declared: &str) -> Option<Self>
pub fn from_declared_type(declared: &str) -> Option<Self>
Resolve a declared SQL type string to a float width, or None when the
string does not name a floating-point type.
Matching is case-insensitive and boundary-aware, using the same idiom as
IntWidth::from_declared_type: a
keyword matches when the (trimmed, lowercased) input either equals it
exactly or is followed by ( or whitespace, so trailing modifiers
("REAL NOT NULL") and parameterised spellings still resolve. The
boundary check is also what keeps bare float from swallowing
float4/float8/float32/float64 as prefixes — the next character
is a digit, which is neither ( nor whitespace — so the arm order below
is not load-bearing.
§Keyword mapping
Bare FLOAT is double precision, matching PostgreSQL (and the SQL
standard), not single. REAL is always single. FLOAT(p) follows
PostgreSQL’s precision rule: p <= 24 is real, p >= 25 is
double precision. A (p) that is absent, unterminated, non-numeric,
or outside 1..=53 falls back to the wider F64 rather than guessing —
widening is the only lossless direction.
Sourcepub const fn pg_oid(self) -> u32
pub const fn pg_oid(self) -> u32
The PostgreSQL type OID a column of this width advertises in
RowDescription and in catalog introspection.
Sourcepub const fn pg_type_name(self) -> &'static str
pub const fn pg_type_name(self) -> &'static str
The canonical PostgreSQL type name, for error messages that must read
like PostgreSQL’s own (value out of range for type real).
Trait Implementations§
Source§impl Clone for FloatWidth
impl Clone for FloatWidth
impl Copy for FloatWidth
Source§impl Debug for FloatWidth
impl Debug for FloatWidth
Source§impl<'de> Deserialize<'de> for FloatWidth
impl<'de> Deserialize<'de> for FloatWidth
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for FloatWidth
Source§impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for FloatWidth
impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for FloatWidth
Source§impl Hash for FloatWidth
impl Hash for FloatWidth
Source§impl Ord for FloatWidth
impl Ord for FloatWidth
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for FloatWidth
impl PartialEq for FloatWidth
Source§impl PartialOrd for FloatWidth
impl PartialOrd for FloatWidth
Source§impl Serialize for FloatWidth
impl Serialize for FloatWidth
impl StructuralPartialEq for FloatWidth
Source§impl ToMessagePack for FloatWidth
impl ToMessagePack for FloatWidth
Source§fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error>
fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error>
Source§fn write_slice<W>(values: &[Self], writer: &mut W) -> Result<(), Error>
fn write_slice<W>(values: &[Self], writer: &mut W) -> Result<(), Error>
Source§fn size_hint(&self) -> Option<TrustedSizeHint>
fn size_hint(&self) -> Option<TrustedSizeHint>
Self::write, or None when it cannot be determined cheaply. Read moreAuto Trait Implementations§
impl Freeze for FloatWidth
impl RefUnwindSafe for FloatWidth
impl Send for FloatWidth
impl Sync for FloatWidth
impl Unpin for FloatWidth
impl UnsafeUnpin for FloatWidth
impl UnwindSafe for FloatWidth
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> FromMessagePackOwned for Twhere
T: for<'a> FromMessagePack<'a>,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.