Expand description
Functions to extract a type T from a type declaration Option<T>.
These functions return Result rather than Option so they can be used with the ? operator
§Heuristics
Since proc-macros don’t have access to type information, we have no way of telling if some
Type is really an Option. We can only guess.
ⓘ
use Vec as Option;
#[derive(Serialize)]
struct Evil {
// oh no
evil: Vec<String>
}These functions will return Ok if the given Type is a Type::Path, with a single generic
argument, and the last path segment is "Option"
Functions§
- from_
mut - Extracts a
&mut TypeTfrom anOption<T> - from_
owned - Extracts
TfromOption<T> - from_
ref - Extracts a
&TypeTfrom anOption<T>