Trait sqlite3_ext::FromValue
source · pub trait FromValue {
fn value_type(&self) -> ValueType;
fn get_i32(&self) -> i32;
fn get_i64(&self) -> i64;
fn get_f64(&self) -> f64;
unsafe fn get_blob_unchecked(&self) -> &[u8] ⓘ;
fn get_blob(&mut self) -> Result<&[u8]>;
fn is_null(&self) -> bool { ... }
fn try_get_blob(&self) -> Result<&[u8]> { ... }
unsafe fn get_str_unchecked(&self) -> Result<&str> { ... }
fn get_str(&mut self) -> Result<&str> { ... }
fn try_get_str(&self) -> Result<&str> { ... }
fn to_owned(&self) -> Result<Value> { ... }
}Expand description
Allows access to an underlying SQLite value.
Required Methods§
sourcefn value_type(&self) -> ValueType
fn value_type(&self) -> ValueType
Returns the data type of the ValueRef. Note that calling get methods on the ValueRef may cause a conversion to a different data type, but this is not guaranteed.
sourceunsafe fn get_blob_unchecked(&self) -> &[u8] ⓘ
unsafe fn get_blob_unchecked(&self) -> &[u8] ⓘ
Get the bytes of this BLOB value.
Safety
If the type of this value is not BLOB, the behavior of this function is undefined.
Provided Methods§
sourcefn is_null(&self) -> bool
fn is_null(&self) -> bool
Convenience method equivalent to self.value_type() == ValueType::Null.
sourcefn try_get_blob(&self) -> Result<&[u8]>
fn try_get_blob(&self) -> Result<&[u8]>
Attempt to interpret this value as a BLOB, without converting. If the underlying data type is not a BLOB, this function will fail with Err(SQLITE_MISMATCH).
sourceunsafe fn get_str_unchecked(&self) -> Result<&str>
unsafe fn get_str_unchecked(&self) -> Result<&str>
Get the underlying TEXT value.
This method will fail if the value has invalid UTF-8.
Safety
If the type of this value is not TEXT, the behavior of this function is undefined.
sourcefn get_str(&mut self) -> Result<&str>
fn get_str(&mut self) -> Result<&str>
Interpret the value as TEXT.
This method will fail if SQLite runs out of memory while converting the value, or if the value has invalid UTF-8.
sourcefn try_get_str(&self) -> Result<&str>
fn try_get_str(&self) -> Result<&str>
Attempt to interpret this value as TEXT, without converting. If the underlying data type is not TEXT, this function will fail with Err(SQLITE_MISMATCH). This function can also fail if the string has invalid UTF-8.