Skip to main content

OutgoingDestination

Trait OutgoingDestination 

Source
pub trait OutgoingDestination {
    type Form: DestinationForm;

    const DESTINATION: &'static str = "";
    const PARAMETERS: &'static [&'static str] = _;
}
Expand description

Declares where a message type is sent.

#[derive(Outgoing)] implements it from the type’s #[outgoing(name = ..)] attribute, and Form is what the publish builder reads to decide which destination position the call site has to fill:

  • #[outgoing(name = "orders.done")] declares FixedName: the destination is resolved by the declaration, and the builder offers no to(..) at all.
  • #[outgoing(name = "orders.{tenant}.v1")] declares NameTemplate: the builder’s to() opens one setter per placeholder, and the publish terminal appears once every one of them is bound.
  • a derive with no name declares CallerName: the builder takes the destination as to("orders.archived").

In every case the destination exists before the publish does, so an under-specified call site is a compile error rather than a runtime surprise.

§Examples

use ruststream::prelude::*;

struct OrderDone;

// What `#[derive(Outgoing)]` + `#[outgoing(name = "orders.done")]` generates:
impl OutgoingDestination for OrderDone {
    type Form = FixedName;
    const DESTINATION: &'static str = "orders.done";
}

Provided Associated Constants§

Source

const DESTINATION: &'static str = ""

The declared destination: its literal name, the template with the placeholders in braces, or the empty string when the type declares none.

Source

const PARAMETERS: &'static [&'static str] = _

The template’s placeholder names, in the order they appear in DESTINATION. Empty for the other two forms; the generated document turns it into the channel’s parameters block.

Required Associated Types§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl OutgoingDestination for String

Source§

impl<T> OutgoingDestination for Vec<T>

Implementors§