mod axis;
mod docs;
mod eager;
mod outs;
mod reply;
mod reply_slots;
mod value;
mod verdict;
#[cfg(all(test, feature = "memory", feature = "json", feature = "asyncapi"))]
mod matrix_tests;
#[cfg(all(test, feature = "memory", feature = "json", feature = "asyncapi"))]
mod parity_tests;
#[doc(hidden)]
pub use axis::{
Axis, AxisDocs, Batch, BatchPair, BatchedAxis, DecodeOutcome, Solo, SoloAxis, SoloPair,
};
pub use axis::{BatchDeserialized, Deserialized, Input, Message, SoloDeserialized};
#[doc(hidden)]
pub use docs::{DocState, Docs, Probed, ProbedDocs};
pub use docs::{Documentable, Documented, Undocumented};
#[doc(hidden)]
pub use outs::{EntryMarkers, OutPos, SelectSlot};
pub use outs::{OutEntry, Outs, Slot};
#[doc(hidden)]
pub use reply::{
DeclaresReply, RedirectableReply, ReplyDest, ReplyDestination, ReplyFormFor,
ReplyHeadersSchema, ReplyRoute, ResolveDestination, WireDocs, declared_reply_destination,
reply_destination,
};
pub use reply::{ReplyShape, Serialized};
pub use value::{
DeclaredDest, EncodedReply, HandleValue, IsDocumented, NamedDest, ReplyValue, ResolvedDest,
Sealed, SerializedReply, subscriber,
};
#[doc(hidden)]
pub use value::{
ProbedDeclaredReplyDef, ProbedReplyDef, UnbuiltDefinition, probed_declared_reply_def,
probed_def, probed_reply_def,
};
pub use verdict::Verdict;
#[doc(hidden)]
pub use verdict::{Batched, OneByOne, VerdictFamily};
pub type ValueBuilder<Def, Src> = crate::runtime::settings::SubscriberBuilder<
Def,
<Src as IntoSource>::Source,
crate::runtime::settings::AllOpen,
>;
use std::borrow::Cow;
use std::future::Future;
#[cfg(feature = "memory")]
use crate::memory::{MemoryPattern, MemorySource};
use crate::{Name, Unnamed};
use super::context::Context;
pub trait Handle<In: ?Sized + Input, R = (), O = (), C = (), S = ()>: Send + Sync {
fn handle(
&self,
input: &In,
outs: &O,
ctx: &mut Context<'_, C, S>,
) -> impl Future<Output = Verdict<In, R>> + Send;
}
#[diagnostic::on_unimplemented(
message = "`{Self}` does not name a subscription source",
note = "pass a subject string (`subscriber(\"orders\", ..)`), a `Name`, or a broker's own \
source descriptor"
)]
pub trait IntoSource {
type Source;
fn into_source(self) -> Self::Source;
}
impl IntoSource for &'static str {
type Source = Name;
fn into_source(self) -> Name {
Name::new(self)
}
}
impl IntoSource for String {
type Source = Name;
fn into_source(self) -> Name {
Name::new(self)
}
}
impl IntoSource for Cow<'static, str> {
type Source = Name;
fn into_source(self) -> Name {
Name::new(self)
}
}
impl IntoSource for Name {
type Source = Self;
fn into_source(self) -> Self {
self
}
}
impl<S> IntoSource for Unnamed<S> {
type Source = Self;
fn into_source(self) -> Self {
self
}
}
#[cfg(feature = "memory")]
impl IntoSource for MemorySource {
type Source = Self;
fn into_source(self) -> Self {
self
}
}
#[cfg(feature = "memory")]
impl IntoSource for MemoryPattern {
type Source = Self;
fn into_source(self) -> Self {
self
}
}