pub fn from_owned(ty: Type) -> Result<Type>Expand description
Extracts T from Option<T>
§Errors
Returns an error if the given type is not an Option<T>. For more information, see the module-level documentation
§Example
use darling::util::extract_option;
use quote::ToTokens;
use syn::Type;
let ty: Type = syn::parse_str("::std::option::Option<String>")?;
let result = extract_option::from_owned(ty)?;
let result = result.into_token_stream().to_string();
assert_eq!(result, "String");