1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Compile-time queue identity.
//!
//! A queue's name is otherwise a bare string repeated on both sides —
//! `#[process(queue = "audio")]` on the consumer, `push_json("audio", …)` on
//! the producer — with nothing linking the two literals or the payload type
//! either side agrees on. [`QueueName`] turns that identity into a **type**
//! that carries both facts: the wire name ([`QueueName::NAME`]) and the job
//! type ([`QueueName::Job`]). Declared once at the feature port next to the
//! [`Job`] payload with the [`queue`](crate::queue) attribute macro, it is the
//! single artifact producer and consumer both import — so a typo or a
//! mismatched payload becomes a compile error instead of a job that silently
//! never drains.
use crateJob;
/// The type-level identity of a queue: its wire name plus the [`Job`] payload
/// it carries. Implemented by the [`queue`](crate::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`](crate::JobProducerExt::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.