gtk-rs-core
gtk-rs-core copied to clipboard
Provide a custom error with attached data
When using functions FileExtManual::replace_contents_future
the error type does not implement std::Error
and using the ?
operator requires mapping the error in an awkward way, one possibility is to add a type glib::ErrorWithData
with an api that looks like
struct ErrorWithData<T> {
// ..
}
impl<T> ErrorWithData<T> {
fn data(&self) -> &T {
// ..
}
}
// Or Into<glib::Error>
impl<T> From<ErrorWithData<T>> for glib::Error {
// ..
}