Skip to main content

FromSql

Trait FromSql 

Source
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§

Source

fn from_sql(s: &'a [u8]) -> IResult<'a, Self>

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.

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, Self>

Source§

impl<'a> FromSql<'a> for &'a [u8]

Used for byte strings that have no escape sequences.

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, Self>

Source§

impl<'a> FromSql<'a> for bool

Parses a bool from 1 or 0.

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, Self>

Source§

impl<'a> FromSql<'a> for f32

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

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, f32>

Source§

impl<'a> FromSql<'a> for f64

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

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, f64>

Source§

impl<'a> FromSql<'a> for i8

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, i8>

Source§

impl<'a> FromSql<'a> for i16

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, i16>

Source§

impl<'a> FromSql<'a> for i32

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, i32>

Source§

impl<'a> FromSql<'a> for i64

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, i64>

Source§

impl<'a> FromSql<'a> for u8

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, u8>

Source§

impl<'a> FromSql<'a> for u16

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, u16>

Source§

impl<'a> FromSql<'a> for u32

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, u32>

Source§

impl<'a> FromSql<'a> for u64

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, u64>

Source§

impl<'a> FromSql<'a> for ()

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, Self>

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.

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, Self>

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.

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, Self>

Source§

impl<'a, T> FromSql<'a> for Option<T>
where T: FromSql<'a>,

Source§

fn from_sql(s: &'a [u8]) -> IResult<'a, Self>

Implementors§

Source§

impl<'a> FromSql<'a> for ContentModel<'a>

Source§

impl<'a> FromSql<'a> for MajorMime<'a>

Source§

impl<'a> FromSql<'a> for MediaType<'a>

Source§

impl<'a> FromSql<'a> for PageAction<'a>

Source§

impl<'a> FromSql<'a> for PageType

Source§

impl<'a> FromSql<'a> for ProtectionLevel<'a>

Source§

impl<'a> FromSql<'a> for MinorMime<'a>

Source§

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.

Source§

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.

Source§

impl<'a> FromSql<'a> for Sha1<'a>

Source§

impl<'a> FromSql<'a> for UserGroup<'a>

Source§

impl<'input> FromSql<'input> for Expiry

Source§

impl<'input> FromSql<'input> for ActorId

Source§

impl<'input> FromSql<'input> for CategoryId

Source§

impl<'input> FromSql<'input> for ChangeTagDefinitionId

Source§

impl<'input> FromSql<'input> for ChangeTagId

Source§

impl<'input> FromSql<'input> for CommentId

Source§

impl<'input> FromSql<'input> for ExternalLinkId

Source§

impl<'input> FromSql<'input> for FullPageTitle

Source§

impl<'input> FromSql<'input> for LinkTargetId

Source§

impl<'input> FromSql<'input> for LogId

Source§

impl<'input> FromSql<'input> for PageCount

Source§

impl<'input> FromSql<'input> for PageId

Source§

impl<'input> FromSql<'input> for PageNamespace

Source§

impl<'input> FromSql<'input> for PageRestrictionId

Source§

impl<'input> FromSql<'input> for PageTitle

Source§

impl<'input> FromSql<'input> for RecentChangeId

Source§

impl<'input> FromSql<'input> for RevisionId

Source§

impl<'input> FromSql<'input> for Timestamp

Source§

impl<'input> FromSql<'input> for UserId