pub trait Resolve<X: Resolvable> {
// Required method
fn resolve(self) -> X;
}
Expand description
This trait is intended to be used as an impl
argument in helper methods, to accept
a wider range of arguments.
It should only be used where it is safe to panic if the wrong argument is provided, and where performance isn’t a primary concern.
It’s not expected for other types to implement this trait directly - instead they
should implement TryFrom
to convert between the types.
If resolution needs to be keyed against an external resolver (e.g. a look-up to translate
string names into values), then LabelledResolve
should be used instead.
§Implementers
- You should prefer to implement
ResolveFrom
as it is easier to implement due to trait coherence rules. Sometimes you can only implementResolve
however. - If requiring a labelled resolution in your bounds, prefer
Resolve
because slightly more types can implement it.