pub fn from_mut(ty: &mut Type) -> Result<&mut Type>Expand description
Extracts a &mut Type T from an 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 mut ty: Type = syn::parse_str("::std::option::Option<String>")?;
let result = extract_option::from_mut(&mut ty)?;
let result = result.into_token_stream().to_string();
assert_eq!(result, "String");