Impl From<SqlBuilderError> for diesel::result::Error

Hi , i'm new in rust. I'm trying to implement From trait for two different types in different crates.
but i found this error.

impl From < SqlBuilderError >for diesel::result::Error {
| ^^^^^---------------------^^^^^---------------------^^^^^^^^^^^^^^^^^^^^^^^^^
| | | |
| | | diesel::result::Error is not defined in the current crate
| | SqlBuilderError is not defined in the current crate
| impl doesn't use only types from inside the current crate

Trait implementations must obey the "orphan rules", which in loose terms say that either the trait or at least some of the types involved have to be local to the crate. Under the rules, this:

impl From<SqlBuilderError> for diesel::result::Error

is only legal in From's crate, in SqlBuilderError's crate, or in the diesel::result crate.

Perhaps what you need is a custom error type, and some implementations From both SqlBuilderError and diesel::result::Error.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.