mirror of https://github.com/Trivernis/bromine.git
commit
eefef04092
@ -0,0 +1,26 @@
|
|||||||
|
name: Publish a release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: cargo test --verbose
|
||||||
|
|
||||||
|
- name: Login
|
||||||
|
with:
|
||||||
|
crates_io_token: ${{secrets.CRATES_IO_TOKEN}}
|
||||||
|
run: cargo login
|
||||||
|
|
||||||
|
- name: Publish to crates.io
|
||||||
|
run: cargo publish
|
@ -1,2 +1,3 @@
|
|||||||
pub mod builder;
|
pub mod builder;
|
||||||
pub mod namespace;
|
pub mod namespace;
|
||||||
|
pub mod provider_trait;
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
use crate::events::event_handler::EventHandler;
|
||||||
|
use crate::namespace::Namespace;
|
||||||
|
|
||||||
|
pub trait NamespaceProvider {
|
||||||
|
fn name() -> String;
|
||||||
|
fn register(handler: &mut EventHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Namespace {
|
||||||
|
pub fn from_provider<N: NamespaceProvider>() -> Self {
|
||||||
|
let name = N::name();
|
||||||
|
let mut handler = EventHandler::new();
|
||||||
|
N::register(&mut handler);
|
||||||
|
|
||||||
|
Self::new(name, handler)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue