Go to file
Mahmut Bulut 45ae8e642a
Add usage and fix dependency problems
2019-10-06 13:25:44 +02:00
.github Add usage and fix dependency problems 2019-10-06 13:25:44 +02:00
examples Add undying main example 2019-10-06 00:14:08 +02:00
src Add usage and fix dependency problems 2019-10-06 13:25:44 +02:00
.gitignore Initial proc macro attrib code 2019-10-05 23:53:30 +02:00
Cargo.toml Add usage and fix dependency problems 2019-10-06 13:25:44 +02:00
LICENSE-APACHE add license 2019-10-06 00:02:18 +02:00
LICENSE-MIT add license 2019-10-06 00:02:18 +02:00
README.md Add usage and fix dependency problems 2019-10-06 13:25:44 +02:00

README.md

Fort

Fort is proc macro attribute crate for Bastion.

Usage

[dependencies]
fort = "0.1"
bastion = "0.2.*"

You can directly use fort to load work onto the root supervisor with:

#[fort::root]
fn main() {
    println!("Running in Bastion runtime!");
}

Make your program fault-tolerant with fort:

#[fort::root]
fn main() {
    loop {
        println!("Undying main!");
        panic!("Error")
    }
}

Example TCP Server

use std::io::Write;
use std::net::TcpListener;

#[fort::root]
fn main() {
    let listener = TcpListener::bind("127.0.0.1:2278").unwrap();
    println!("TCP server started at 127.0.0.1:2278");
    for stream in listener.incoming() {
        let mut stream = stream.unwrap();
        stream.write(b"Hello World\r\n").unwrap();
        panic!("Fail here!");
    }
}