mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,4 Tsd.
aktive Profile

#thiserror

0 Beiträge0 Beteiligte0 Beiträge heute

@greysemanticist It works, because thiserror generates a From impl for rusqlite::Error for your AuthError (due to the #[from] attribute).

And ? will use that From impl to return AuthError.

See also the std #Rust docs on how ? works:

"When applied to values of the Result<T, E> type, it propagates errors. If the value is Err(e), then it will return Err(From::from(e)) from the enclosing function or closure."

doc.rust-lang.org/reference/ex

#thiserror and ? can look like magic, but it's just #RustLang

doc.rust-lang.orgOperator expressions - The Rust Reference