I have a UserSession
struct, and a User
struct. I want to cache a pointer to the user from the UserSession
struct to the User
struct. To pass them around together, i.e.:
#[derive(Debug, FromRow, SerializeRow)]
pub struct UserSession {
pub uid: String,
pub lang: Option<String>,
pub created: i64,
pub accessed: i64,
pub ip: String,
pub user_uid: String,
// ignore this
pub info: Option<User>,
}
However, there is something about the User
object, the driver doesn’t like, I now get this error in rust:
30 | pub info: Option<User>,
| ^^^^^^^^^^^^^^ the trait `FromCqlVal<Option<CqlValue>>` is not implemented for `Option<User>`
I have spent some time trying to work out how to make this error go away, I notice that there is something called #[scylla(skip)]
but it seems not useful in this case.
How can I make the driver either ignore that cache info:Option<User>
field, or make the info:Option<User>
serializable so that the error goes away (even though I don’t need to serialize it).
I realize a workaround would be to create two versions of the Session
struct, and copy out of that a Session2
struct with the cached field, but why do extra memory copies if we dont need to right?