MCPcopy Index your code
hub / github.com/bastion-rs/fort

github.com/bastion-rs/fort @v0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.0 ↗ · + Follow
6 symbols 6 edges 6 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Fort

Fort is proc macro attribute crate for Bastion.

Usage

[dependencies]
fort = "0.4"
bastion = "0.4"

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

#[fort::root]
async fn main(_: BastionContext) -> Result<(), ()> {
    println!("Running in Bastion runtime!");
    Ok(())
}

Make your program fault-tolerant with fort:

#[fort::root]
async fn main(_: BastionContext) -> Result<(), ()> {
    loop {
        println!("Undying main!");
        panic!("Error")
    }
}

You want to spawn multiple process

#[fort::root(redundancy = 10)]
async fn main(_: BastionContext) -> Result<(), ()> {
    loop {
        println!("Undying main!");
        panic!("Error")
    }
}

Example TCP Server

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

#[fort::root]
async fn main(_: BastionContext) -> Result<(), ()> {
    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() {
        thread::spawn(|| {
            let mut stream = stream.unwrap();
            stream.write_all(b"Hello World\r\n").unwrap();
            panic!("Fail in thread!");
        });
        panic!("Fail in event loop");
    }

    Ok(())
}

Core symbols most depended-on inside this repo

root
called by 0
src/lib.rs
main
called by 0
examples/tcp_server.rs
main
called by 0
examples/redundancy.rs
main
called by 0
examples/simple.rs
main
called by 0
examples/threaded_tcp_server.rs
main
called by 0
examples/panic.rs

Shape

Function 6

Languages

Rust100%

Modules by API surface

src/lib.rs1 symbols
examples/threaded_tcp_server.rs1 symbols
examples/tcp_server.rs1 symbols
examples/simple.rs1 symbols
examples/redundancy.rs1 symbols
examples/panic.rs1 symbols

For agents

$ claude mcp add fort \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page