DABus

DABus is a multi-type aplication bus. It allows for you to have multiple completely independant "Handlers" or "Bus Stops" that you can interact with and can interact with eachother without aknowlaging eachothers existance. it maintains all of rust's type saftey and guarentees, while being able to act in a highly dynamic fasion, almost like something out of javascript, but with none of the downsides.

Key Features

Limitations

Usage

A event handler for DABus is a simple struct method, something like this:

```rust use dabus::BusInterface;

[derive(Debug)]

struct ExampleHandler;

impl ExampleHandler { async fn hello_world(&mut self, arguments: (), mut _interface: BusInterface) { /* here, arguments is the args passed to the event call, and _interface is a struct for communicating with the bus that invoked it

    warning! do NOT use BusInterface outside of the async handler it was passed to!
    it may seem like a good way of doing things, but IT WILL NOT WORK!!!
    */
    println!("Hello, World!");
}

} ```

and then define the event it goes along with

rust // the name args return type dabus::event!(HELLO_EVENT, (), ());

To convert this from a regular struct to an bus stop, implement BusStop

```rust use dabus::{BusStop, EventRegister};

impl BusStop for HelloHandler { // this function provides a list of the handlers that this stop provides fn registeredhandlers(h: EventRegister) -> EventRegister { // event def event function h.handler(HELLOEVENT, Self::hello_world) } } ```

and finally, to use this

```rust use dabus::DABus;

[tokio::main]

async fn main() { let mut bus = DABus::new(); // create a new instance of HelloHandler, and pass it to the bus for useage bus.register(HelloHandler); // the event arguments (type from event def) bus.fire(PRINTEVENT, "Hello, World!".tostring()).await.unwrap(); // you should now see Hello, World! on your terminal! } ```

Important Note

This crate requires nightly!

this is why:

```rust

![feature(downcast_unchecked)]

![feature(drain_filter)]

![allow(incomplete_features)]

![feature(specialization)]

```

TODO's