macros says field can be null i have to wrap that field in option in my struct. So now im confused because i have struct like this:
#[derive(Deserialize, Serialize, Debug)]
pub struct User {
pub id: String,
pub username: String,
pub email: String,
pub password: String,
}
And my table looks like this:
users (
id TEXT PRIMARY KEY,
username TEXT NOT NULL,
email TEXT NOT NULL,
password TEXT NOT NULL
);
They are clearly not null, but smh i get an error:
the trait bound
std::string::String: std::convert::From<std::option::Option<std::string::String>>
is not satisfied
the following other types implement traitstd::convert::From<T>
:
<std::string::String as std::convert::From>
<std::string::String as std::convert::Frombytestring::ByteString>
<std::string::String as std::convert::From<Box>>
<std::string::String as std::convert::Fromurl::Url>
<std::string::String as std::convert::From<Cow<'a, str>>>
<std::string::String as std::convert::From<&str>>
<std::string::String as std::convert::From<&mut str>>
<std::string::String as std::convert::From<&std::string::String>>
required forstd::option::Option<std::string::String>
to implementInto<std::string::String>
I looked for this type of error and found topic on stackoverflow, but best answer there is just wrap all fields in options. I dont want to do this becuse:
- They are not options, they cant be None
- I have to unwrap every time i need to use field