2022-12-11 15:16:43 -06:00
|
|
|
use std::cell::RefCell;
|
|
|
|
|
|
|
|
pub struct MessageListeners<'a> {
|
|
|
|
listeners: RefCell<Vec<Box<dyn FnMut(()) + 'a>>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait MessageListenersInterface {
|
|
|
|
fn listeners<'c>(&'c self) -> &'c MessageListeners<'c>;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> MessageListenersInterface for MessageListeners<'a> {
|
|
|
|
fn listeners<'b>(&'b self) -> &'a MessageListeners<'b> {
|
2024-02-27 17:30:07 -06:00
|
|
|
//~^ ERROR in type `&'a MessageListeners<'_>`, reference has a longer lifetime than the data it references
|
2022-12-11 15:16:43 -06:00
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|