pub enum ValueRef<'a> {
Null,
Integer(i64),
Real(f64),
Text(&'a [u8]),
Blob(&'a [u8]),
}
Expand description
A non-owning dynamic type value. Typically, the memory backing this value is owned by SQLite.
See Value
for an owning dynamic type value.
Variants§
Null
The value is a NULL
value.
Integer(i64)
The value is a signed integer.
Real(f64)
The value is a floating point number.
Text(&'a [u8])
The value is a text string.
Blob(&'a [u8])
The value is a blob of data
Implementations§
Source§impl<'a> ValueRef<'a>
impl<'a> ValueRef<'a>
Sourcepub fn as_i64(&self) -> FromSqlResult<i64>
pub fn as_i64(&self) -> FromSqlResult<i64>
If self
is case Integer
, returns the integral value. Otherwise,
returns Err(Error::InvalidColumnType)
.
Sourcepub fn as_i64_or_null(&self) -> FromSqlResult<Option<i64>>
pub fn as_i64_or_null(&self) -> FromSqlResult<Option<i64>>
If self
is case Null
returns None.
If self
is case Integer
, returns the integral value.
Otherwise, returns Err(Error::InvalidColumnType)
.
Sourcepub fn as_f64(&self) -> FromSqlResult<f64>
pub fn as_f64(&self) -> FromSqlResult<f64>
If self
is case Real
, returns the floating point value. Otherwise,
returns Err(Error::InvalidColumnType)
.
Sourcepub fn as_f64_or_null(&self) -> FromSqlResult<Option<f64>>
pub fn as_f64_or_null(&self) -> FromSqlResult<Option<f64>>
If self
is case Null
returns None.
If self
is case Real
, returns the floating point value.
Otherwise, returns Err(Error::InvalidColumnType)
.
Sourcepub fn as_str(&self) -> FromSqlResult<&'a str>
pub fn as_str(&self) -> FromSqlResult<&'a str>
If self
is case Text
, returns the string value. Otherwise, returns
Err(Error::InvalidColumnType)
.
Sourcepub fn as_str_or_null(&self) -> FromSqlResult<Option<&'a str>>
pub fn as_str_or_null(&self) -> FromSqlResult<Option<&'a str>>
If self
is case Null
returns None.
If self
is case Text
, returns the string value.
Otherwise, returns Err(Error::InvalidColumnType)
.
Sourcepub fn as_blob(&self) -> FromSqlResult<&'a [u8]>
pub fn as_blob(&self) -> FromSqlResult<&'a [u8]>
If self
is case Blob
, returns the byte slice. Otherwise, returns
Err(Error::InvalidColumnType)
.
Sourcepub fn as_blob_or_null(&self) -> FromSqlResult<Option<&'a [u8]>>
pub fn as_blob_or_null(&self) -> FromSqlResult<Option<&'a [u8]>>
If self
is case Null
returns None.
If self
is case Blob
, returns the byte slice.
Otherwise, returns Err(Error::InvalidColumnType)
.
Sourcepub fn as_bytes(&self) -> FromSqlResult<&'a [u8]>
pub fn as_bytes(&self) -> FromSqlResult<&'a [u8]>
Returns the byte slice that makes up this ValueRef
if it’s either
ValueRef::Blob
or ValueRef::Text
.
Sourcepub fn as_bytes_or_null(&self) -> FromSqlResult<Option<&'a [u8]>>
pub fn as_bytes_or_null(&self) -> FromSqlResult<Option<&'a [u8]>>
If self
is case Null
returns None.
If self
is ValueRef::Blob
or ValueRef::Text
returns the byte
slice that makes up this value
Trait Implementations§
impl<'a> Copy for ValueRef<'a>
impl<'a> StructuralPartialEq for ValueRef<'a>
Auto Trait Implementations§
impl<'a> !Crossing for ValueRef<'a>
impl<'a> Freeze for ValueRef<'a>
impl<'a> !ObjSafe for ValueRef<'a>
impl<'a> RefUnwindSafe for ValueRef<'a>
impl<'a> Send for ValueRef<'a>
impl<'a> StoreCopy for ValueRef<'a>
impl<'a> Sync for ValueRef<'a>
impl<'a> Unpin for ValueRef<'a>
impl<'a> UnwindSafe for ValueRef<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
] or
a color-specific method, such as [OwoColorize::green
], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
] or
a color-specific method, such as [OwoColorize::on_yellow
], Read more