
Publisher.pudu
Pudu27 lines1.2 KB
1/** @Mediator.Publisher.Seam — what a component that only publishes notifications depends on */2module PuduLangMediator.Publisher34import PuduLangMediator.Context as Context5import PuduLangMediator.Mediator as Mediator6import PuduLangMediator.Message as Message7import PuduLangMediator as Messaging8import PuduLangMediator.Notification as Notification910/** @Mediator.Publisher.Publisher — publishes notifications; a mediator or a test double */11export trait Publisher {12 13 fn publish[N, E](self: &Self, subject: &Notification.Kind[N, E], notification: N, context: Context.Context) -> Messaging.Outcome[(), E]14 15 fn broadcast(self: &Self, envelope: Message.Envelope, context: Context.Context) -> Message.Answer16}1718impl Publisher for Mediator.Mediator {19 20 fn publish[N, E](self: &Self, subject: &Notification.Kind[N, E], notification: N, context: Context.Context) -> Messaging.Outcome[(), E] {21 Mediator.publishWith(self, subject, notification, context)22 }2324 25 fn broadcast(self: &Self, envelope: Message.Envelope, context: Context.Context) -> Message.Answer { Mediator.broadcastWith(self, envelope, context) }26}27