pub trait QueueName: 'static {
type Job: Job;
const NAME: &'static str;
}Expand description
The type-level identity of a queue: its wire name plus the Job payload
it carries. Implemented by the queue macro on a unit
struct living beside the payload at the feature port:
use nest_rs_queue::{queue, QueueName};
// Any `T: Serialize + DeserializeOwned + Clone + Send + Sync + Unpin` is a
// `Job`; a real feature uses its own `TranscodeCommand` payload struct.
#[queue(name = "transcode", job = String)]
struct TranscodeQueue;
assert_eq!(<TranscodeQueue as QueueName>::NAME, "transcode");Both sides then name the type, not the string:
push_to on the producer and
#[process(queue = TranscodeQueue)] on the consumer. The macro asserts the
process method’s job argument is Self::Job, so a mismatch is a compile
error naming both types.
Required Associated Constants§
Required Associated Types§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".