Skip to content

Commit a4f7867

Browse files
committed
add exprt macro
1 parent ee423e7 commit a4f7867

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/n0des.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,13 @@ pub trait N0de: 'static + Send {
88
Self: Sized;
99
fn shutdown(&mut self) -> impl Future<Output = Result<()>> + Send;
1010
}
11+
12+
#[macro_export]
13+
macro_rules! export_node {
14+
($type:ty) => {
15+
#[no_mangle]
16+
pub extern "C" fn load_plugin() -> Box<dyn $crate::N0de> {
17+
Box::new(<$type>::default())
18+
}
19+
};
20+
}

0 commit comments

Comments
 (0)