Supertrait for actix actors

#1

I’m trying to implement a subscriber system for actix::Actor. Here’s my code:

use actix::prelude::*;

#[derive(Message)]
struct Notify;

#[derive(Message)]
struct RegisterListener(Recipient<Notify>);

trait Notifier<C: ActorContext>: Actor<Context=C> {
    // has to be implemented
    fn listeners(&self) -> &[Recipient<Notify>];
    fn listeners_mut(&mut self) -> &mut Vec<Recipient<Notify>>;

    // default
    fn register_listener(&mut self, l: Recipient<Notify>) {
        self.listeners_mut().push(l);
    }
    fn notify_listeners(&self) {
        self.listeners().iter().for_each(|l| { l.do_send(Notify); });
    }
}

// Critical impl: This doesn't work
impl<C: ActorContext> Handler<RegisterListener> for Notifier<C, Context=C> {
    type Result = ();

    fn handle(&mut self, msg: RegisterListener, _: &mut C) -> () {
        self.register_listener(msg.0);
    }
}

// example impls
struct N {
    listeners: Vec<Recipient<Notify>>,
}

impl Actor for N {
    type Context = Context<Self>;
}

impl Notifier<Context<N>> for N {
    fn listeners(&self) -> &[Recipient<Notify>] {
        self.listeners.as_slice()
    }
    fn listeners_mut(&mut self) -> &mut Vec<Recipient<Notify>> {
        &mut self.listeners
    }
}

struct L;

impl Actor for L {
    type Context = Context<Self>;
}

impl Handler<Notify> for L {
    type Result = ();

    fn handle(&mut self, _: Notify, _: &mut Self::Context) -> () {
        println!("L has been notified");
    }
}

As you can see I want only to implement listeners and listeners_mut for implementing Notifer. However, I can not manage to get a default impl for the RegisterListener handler. Is this even possible?
I tried many ways to place the generics ending up with compiler errors like “Actor is not implemented for (dyn Notifier)”, “Notifier can not be made into an object” and so on.
Could someone help me getting this to work? Or is my approach totally wrong?