pub trait FromSql<'a>: Sized {
    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

Implementations on Foreign Types

Parses a bool from 1 or 0.

Matches a float literal with recognize_float and parses it as a f32.

Matches a float literal with recognize_float and parses it as a f64.

Used for byte strings that have no escape sequences.

Used for types represented as strings without escape sequences. For instance, Timestamps matches the regex ^[0-9: -]+$ and thus never has any escape sequences.

Use this for string types that require unescaping and are guaranteed to be valid UTF-8, like page titles.

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

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.

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.