Trait parse_mediawiki_sql::from_sql::FromSql
source · [−]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
Implementations on Foreign Types
sourceimpl<'a> FromSql<'a> for f32
impl<'a> FromSql<'a> for f32
Matches a float literal with recognize_float
and parses it as a f32
.
sourceimpl<'a> FromSql<'a> for f64
impl<'a> FromSql<'a> for f64
Matches a float literal with recognize_float
and parses it as a f64
.
sourceimpl<'a> FromSql<'a> for &'a str
impl<'a> FromSql<'a> for &'a str
Used for types represented as strings without escape sequences. For instance,
Timestamp
s matches the regex ^[0-9: -]+$
and thus never has any escape sequences.
sourceimpl<'a> FromSql<'a> for String
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.
sourceimpl<'a> FromSql<'a> for Vec<u8>
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
.