linksplatform / doublets-rs

The Unlicense
5 stars 2 forks source link

Use Links trait from data #6

Open uselessgoddess opened 2 years ago

uselessgoddess commented 2 years ago

At the moment Doublets trait use Links trait. This is due to the fact that for a long time data::Links Error = Box<dyn Error>

This is now fixed at https://github.com/linksplatform/data-rs/commit/a2cadfa4744a9eeb28a8f9e6b0ba0e439077667b.

However, data::Error still loses information. It may be worth impl Links for Doublets, instead of Doublets for Links

uselessgoddess commented 2 years ago

It may be worth impl Links for Doublets, instead of Doublets for Links

For example:

//! before
trait Foo {
    fn foo(&self);
}

trait Bar: Foo {
    fn bar(&self) {
        self.foo();
    }
}

//! after
trait Foo {
    fn foo(&self);
}

trait Bar {
    fn bar(&self);
}

impl Foo for Bar {
    fn foo(&self) {
        self.bar()
    } 
}