79553624

Date: 2025-04-03 17:35:55
Score: 0.5
Natty:
Report link

Now rust support it https://github.com/rust-lang/rust/pull/134367

example in the problem

trait Base {
    fn a(&self);
    fn b(&self);
    fn c(&self);
    fn d(&self);
}

trait Derived : Base {
    fn e(&self);
    fn f(&self);
    fn g(&self);
}

struct S;

impl Derived for S {
    fn e(&self) {}
    fn f(&self) {}
    fn g(&self) {}
}

impl Base for S {
    fn a(&self) {}
    fn b(&self) {}
    fn c(&self) {}
    fn d(&self) {}
}

fn example(v: &dyn Derived) {
    v as &dyn Base;
}

playground link https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=e13f174aa408f890a771284206fab07b

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: AsukaMinato