I have
pub fn with_feature(mut self, key: String, val: String) -> Result<License, LicenseError> {
self.user_data.features.insert(key, val);
Ok(self)
}
}
and License, LicenseError are both defined structs.
What do I need to do to have ? work? I have a compilation error with this
License::new()
.with_feature("debug".to_string(), "parts1".to_string())?;
The error being
the ?
operator can only be used in a function that returns Result
but doesn't with_feature return Result?
Of course doing
License::new()
.with_feature("debug".to_string(), "parts1".to_string())
.unwrap()
works, but the snippets above are part of a larger builder sequence and I'd prefer to not insert .unwrap() between each with_XXX call.
Thanks
Mike