pub trait FromSql<'a>: Sized {
// Required method
fn from_sql(s: &'a [u8]) -> IResult<'a, Self>;
}Expand description
Trait for converting from the SQL syntax for a simple type
(anything other than a tuple) to a Rust type,
which can borrow from the string or not.
Used by schemas::FromSqlTuple.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<'a> FromSql<'a> for &'a str
Used for types represented as strings without escape sequences. For instance,
Timestamps matches the regex ^[0-9: -]+$
and thus never has any escape sequences.
impl<'a> FromSql<'a> for &'a str
Used for types represented as strings without escape sequences. For instance,
Timestamps matches the regex ^[0-9: -]+$
and thus never has any escape sequences.
Source§impl<'a> FromSql<'a> for f32
Matches a float literal with recognize_float and parses it as a f32.
impl<'a> FromSql<'a> for f32
Matches a float literal with recognize_float and parses it as a f32.
Source§impl<'a> FromSql<'a> for f64
Matches a float literal with recognize_float and parses it as a f64.
impl<'a> FromSql<'a> for f64
Matches a float literal with recognize_float and parses it as a f64.
Source§impl<'a> FromSql<'a> for String
Use this for string types that require unescaping and are guaranteed
to be valid UTF-8, like page titles.
impl<'a> FromSql<'a> for String
Use this for string types that require unescaping and are guaranteed to be valid UTF-8, like page titles.
Source§impl<'a> FromSql<'a> for Vec<u8>
Used for “strings” that sometimes contain invalid UTF-8, like the
cl_sortkey field in the categorylinks table, which is truncated to 230
bits, sometimes in the middle of a UTF-8 sequence.
impl<'a> FromSql<'a> for Vec<u8>
Used for “strings” that sometimes contain invalid UTF-8, like the
cl_sortkey field in the categorylinks table, which is truncated to 230
bits, sometimes in the middle of a UTF-8 sequence.
Implementors§
impl<'a> FromSql<'a> for ContentModel<'a>
impl<'a> FromSql<'a> for MajorMime<'a>
impl<'a> FromSql<'a> for MediaType<'a>
impl<'a> FromSql<'a> for PageAction<'a>
impl<'a> FromSql<'a> for PageType
impl<'a> FromSql<'a> for ProtectionLevel<'a>
impl<'a> FromSql<'a> for MinorMime<'a>
impl<'a> FromSql<'a> for NotNan<f32>
Parses an f32 and wraps it with NotNan::new_unchecked.
§Safety
This will never accidentally wrap a NaN because nom’s recognize_float doesn’t include a representation of NaN.
impl<'a> FromSql<'a> for NotNan<f64>
Parses an f64 and wraps it with NotNan::new_unchecked.
§Safety
This will never accidentally wrap a NaN because nom’s recognize_float doesn’t include a representation of NaN.