Skip to main content

PackageConsumer

Trait PackageConsumer 

Source
pub trait PackageConsumer: Send + 'static {
    type Value: Send + 'static;

    // Required methods
    fn event(&self) -> &str;
    fn accept(&self) -> &[String];
    fn neutral(&mut self) -> Option<Self::Value>;
    fn consume(
        &mut self,
        content_type: Option<&[u8]>,
        body: &[u8],
    ) -> Result<Self::Value, PackageRejection>;

    // Provided methods
    fn event_id(&self) -> Option<&str> { ... }
    fn empty_terminal_is_valid(&self) -> bool { ... }
}
Expand description

Package-specific parsing behind the generic event lifecycle.

Required Associated Types§

Source

type Value: Send + 'static

Owned application value produced by this package.

Required Methods§

Source

fn event(&self) -> &str

Exact Event package token.

Source

fn accept(&self) -> &[String]

Values advertised in Accept.

Source

fn neutral(&mut self) -> Option<Self::Value>

Neutral value delivered before the first NOTIFY, when the package defines one.

Source

fn consume( &mut self, content_type: Option<&[u8]>, body: &[u8], ) -> Result<Self::Value, PackageRejection>

Parse one bounded NOTIFY body.

Provided Methods§

Source

fn event_id(&self) -> Option<&str>

Optional Event id parameter.

Source

fn empty_terminal_is_valid(&self) -> bool

Whether an empty terminal body is valid without invoking the consumer.

Implementors§