[][src]Crate bastion

Bastion: Fault-tolerant Runtime for Rust applications


Bastion is a fault-tolerant runtime which is designed for recovering from faults based on the supervision strategies that you've passed. It is designed to provide persistent runtime for applications which need to be highly-available.

Why Bastion?

If one of the questions below answered with yes, then Bastion is just for you:

  • Do I need fault-tolerancy in my project?
  • Do I hate to implement weird Actor traits?
  • I shouldn't need a webserver to run an actor system, right?
  • Do I want to make my existing code unbreakable?
  • Do I have some trust issues against orchestration systems? Because I want to implement my own application lifecycle.


  • Message-based communication makes this project a lean mesh of actor system.
    • without web servers, weird shenanigans, forced trait implementations, and static dispatch.
  • Runtime fault-tolerance makes it a good candidate for small scale distributed system code.
    • If you want to smell of Erlang and it's powerful aspects in Rust. That's it!
  • Supervision makes it easy to manage lifecycles.
    • Kill your application in certain condition or restart you subprocesses whenever a certain condition met. All up to you. And it should be up to you.



Main module for the runtime.


Child management, message generics and communication reside in this module.


Platform configuration for Bastion runtime


Context is generic structure to share resource between supervisor, children and the system.


Macros to use in processes and defining the architecture of runtime.


Generic message types for management of runtime, processes and layers.


Prelude for bare minimum runtime dependencies


Implementations for message gating, receiving and destination definitions.


Supervisor related code. Including their management, creation, and destruction.



Matches incoming messages to the process. Always have a default case to execute if unknown message arrives to the process.