Trait Queryable

Source
pub trait Queryable {
    // Required method
    fn new(row: Row<'_>) -> Self;
}
Expand description

Sructs for holding a row of select data must imlement this trait.

struct User{
    id: u64,
    name: String,
}

impl Queryable for User{
    fn new(row: Row) -> Self{
        User{
            id: row.get("id").unwrap(),
            name: row.get("name").unwrap(),
        }
    }
}

Required Methods§

Source

fn new(row: Row<'_>) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§