Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-mediator

In-process messaging for Pudu: requests, notifications, streams, pipeline behaviors, processors, and exception handling

0.1.0Apache-2.01

InstallClose

Publisher.pudu

Pudu27 lines1.2 KB

GitHub ↗
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  /// The publication's outcome across every handler.13  fn publish[N, E](self: &Self, subject: &Notification.Kind[N, E], notification: N, context: Context.Context) -> Messaging.Outcome[(), E]14  /// The answer to a notification whose type the caller does not name.15  fn broadcast(self: &Self, envelope: Message.Envelope, context: Context.Context) -> Message.Answer16}1718impl Publisher for Mediator.Mediator {19  /// `Mediator.publishWith`.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  /// `Mediator.broadcastWith`.25  fn broadcast(self: &Self, envelope: Message.Envelope, context: Context.Context) -> Message.Answer { Mediator.broadcastWith(self, envelope, context) }26}27