#[macro_export]
macro_rules! local_system {
(mailbox = $mailbox:expr, routes = $routes:expr $(,)?) => {
$crate::prelude::System::new($mailbox, $routes)
};
}
pub mod prelude {
pub use crate::local_system;
pub use bombay::behavior;
pub use bombay::behavior::{
Actions, Address, Behavior, BehaviorFn, Births, Compose, Crash, Create, Deadline, Delivery,
Exit, Handler, MailAddr, Never, NoBirths, Proxy, ProxyCommand, Pure, ReceiveTimeout,
Recipient, RestartPolicy, SendProduct, ServiceSends, Step, StopOnShutdown, Strategy,
SupervisionEvent, Supervisor, User, Watch, WorkerStopped,
};
pub use bombay::{
ActorRef, AddressInUse, AddressRouter, DeliveryRouter, EndpointRegistry,
IncarnationEndpoint, MailboxAnchor, MailboxConfig, RunExit, System, TaskOutcome,
};
}
#[cfg(test)]
mod tests {
use super::prelude::*;
#[test]
fn prelude_selects_the_existing_runtime_types() {
fn same_type<T>(_: &T, _: &T) {}
let direct: System<AddressRouter<MailAddr, ()>> =
System::new(MailboxConfig::bounded(8), AddressRouter::default());
let facade: System<AddressRouter<MailAddr, ()>> = local_system!(
mailbox = MailboxConfig::bounded(8),
routes = AddressRouter::default(),
);
same_type(&direct, &facade);
}
}