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")]declaresFixedName: the destination is resolved by the declaration, and the builder offers noto(..)at all.#[outgoing(name = "orders.{tenant}.v1")]declaresNameTemplate: the builder’sto()opens one setter per placeholder, and the publish terminal appears once every one of them is bound.- a derive with no
namedeclaresCallerName: the builder takes the destination asto("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§
Sourceconst DESTINATION: &'static str = ""
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.
Sourceconst PARAMETERS: &'static [&'static str] = _
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§
Sourcetype Form: DestinationForm
type Form: DestinationForm
The declared form: FixedName, NameTemplate or CallerName.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".