pub struct SerialType(pub u64);Expand description
A SQLite record serial type code.
The mapping from code to meaning (file-format spec, “Serial Type Codes Of The Record Format”):
| code | meaning | body bytes |
|---|---|---|
| 0 | NULL | 0 |
| 1 | int, big-endian | 1 |
| 2 | int | 2 |
| 3 | int | 3 |
| 4 | int | 4 |
| 5 | int | 6 |
| 6 | int | 8 |
| 7 | IEEE-754 float | 8 |
| 8 | integer 0 | 0 |
| 9 | integer 1 | 0 |
| 10, 11 | reserved | — |
| N≥12 even | BLOB | (N-12)/2 |
| N≥13 odd | TEXT | (N-13)/2 |
Tuple Fields§
§0: u64Implementations§
Source§impl SerialType
impl SerialType
Sourcepub fn content_len(self) -> Option<usize>
pub fn content_len(self) -> Option<usize>
Number of bytes this serial type occupies in the record body, or None
for the reserved codes 10 and 11.
Sourcepub fn for_value(value: &Value) -> SerialType
pub fn for_value(value: &Value) -> SerialType
The smallest serial type that can losslessly represent value.
This matches SQLite’s choice: small integers collapse to the 0/1 literals (codes 8/9) and otherwise to the narrowest of the 1/2/3/4/6/8-byte forms.
Trait Implementations§
Source§impl Clone for SerialType
impl Clone for SerialType
Source§fn clone(&self) -> SerialType
fn clone(&self) -> SerialType
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SerialType
Source§impl Debug for SerialType
impl Debug for SerialType
impl Eq for SerialType
Source§impl PartialEq for SerialType
impl PartialEq for SerialType
Source§fn eq(&self, other: &SerialType) -> bool
fn eq(&self, other: &SerialType) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SerialType
Auto Trait Implementations§
impl Freeze for SerialType
impl RefUnwindSafe for SerialType
impl Send for SerialType
impl Sync for SerialType
impl Unpin for SerialType
impl UnsafeUnpin for SerialType
impl UnwindSafe for SerialType
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