pub trait FrpNode<Out>: FrpNodeAny {
fn get(&self) -> (u32, Ref<Out>);
}
pub trait FrpNodeAny {
fn update(&self);
fn parents(&self) -> Vec<Rc<dyn FrpNodeAny>>;
}
pub fn magic<Out>(x: Rc<dyn FrpNode<Out>>) -> Rc<dyn FrpNodeAny> {
// need help writing this function
// preferably without allocating a new Rc
}
Please note that above we have:
pub trait FrpNode<Out>: FrpNodeAny
Is it possible to implement function 'magic'? It seems that if we a have a Rc to a "more detailed" trait, we should be able to get a Rc to the "less detailed" trait. Thanks!
|
34 | vec![self.n0.into_rc_any()]
| ^^^^^^^^^^^ method not found in `std::rc::Rc<(dyn frp_node::FrpNode<T0> + 'static)>`
|
= note: the method `into_rc_any` exists but the following trait bounds were not satisfied:
`dyn frp_node::FrpNode<T0> : frp_node::IntoFrpNodeAny`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `into_rc_any`, perhaps you need to implement it:
candidate #1: `frp_node::IntoFrpNodeAny`