How can I express "anything that converts into StdError" for the associated type?
trait MyTrait {
// I can't use just this, as `anyhow::Error` doesn't implement `StdError`
type Error: std::error::Error;
// so I'm looking for something like this
type Error: Into<StdError> // the trait `Sized` is not implemented for `(dyn StdError + 'static)`
}
Well nothing can be converted into an StdError as it is a trait, not a type. Are you perhaps looking for things convertible into Box<dyn Error> or Box<dyn Error + Send + Sync>?
Alternatively, consider if you need any restrictions at all? You often don't.