Trait skytable::response::FromResponse

source ·
pub trait FromResponse: Sized {
    // Required method
    fn from_response(resp: Response) -> ClientResult<Self>;
}
Expand description

Types that can be parsed from a Response

§Example implementation

Assume that our schema looks like create model mymodel(username: string, password: string, null email: string). Here’s how we can directly get this without any fuss:

use skytable::{
    ClientResult, Config, query,
    response::{FromResponse, Response}
};

struct User {
    username: String,
    password: String,
    email: Option<String>,
}

impl FromResponse for User {
    fn from_response(resp: Response) -> ClientResult<Self> {
        let (username, password, email): (String, String, Option<String>) = FromResponse::from_response(resp)?;
        Ok(Self { username, password, email })
    }
}

let mut db = Config::new_default("username", "password").connect().unwrap();
let myuser: User = db.query_parse(
    &query!("select username, password, email FROM myspace.mymodel WHERE username = ?", "username")
).unwrap();
assert_eq!(myuser.username, "bob");

Required Methods§

source

fn from_response(resp: Response) -> ClientResult<Self>

Decode the target type from the Response

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromResponse for ()

source§

impl<A: FromValue> FromResponse for (A,)

source§

impl<A: FromValue, B: FromValue> FromResponse for (A, B)

source§

impl<A: FromValue, B: FromValue, C: FromValue> FromResponse for (A, B, C)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue> FromResponse for (A, B, C, D)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue> FromResponse for (A, B, C, D, E)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue> FromResponse for (A, B, C, D, E, F)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue> FromResponse for (A, B, C, D, E, F, G)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue> FromResponse for (A, B, C, D, E, F, G, H)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue, S: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue, S: FromValue, T: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue, S: FromValue, T: FromValue, U: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue, S: FromValue, T: FromValue, U: FromValue, V: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue, S: FromValue, T: FromValue, U: FromValue, V: FromValue, W: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue, S: FromValue, T: FromValue, U: FromValue, V: FromValue, W: FromValue, X: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue, S: FromValue, T: FromValue, U: FromValue, V: FromValue, W: FromValue, X: FromValue, Y: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y)

source§

impl<A: FromValue, B: FromValue, C: FromValue, D: FromValue, E: FromValue, F: FromValue, G: FromValue, H: FromValue, I: FromValue, J: FromValue, K: FromValue, L: FromValue, M: FromValue, N: FromValue, O: FromValue, P: FromValue, Q: FromValue, R: FromValue, S: FromValue, T: FromValue, U: FromValue, V: FromValue, W: FromValue, X: FromValue, Y: FromValue, Z: FromValue> FromResponse for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z)

Implementors§