Began implementing fully isomorphic macros
Like Rust's Proc macros. Now we have preprocessor recursion to worry about. I also made a cool macro for enums
This commit is contained in:
@@ -3,7 +3,11 @@ use crate::helpers::enc_vec;
|
||||
|
||||
pub trait Request: Coding + Sized + Send + 'static {
|
||||
type Response: Coding + Send + 'static;
|
||||
fn respond(&self, rep: Self::Response) -> Vec<u8> { enc_vec(&rep) }
|
||||
}
|
||||
|
||||
pub fn respond<R: Request>(_: &R, rep: R::Response) -> Vec<u8> { enc_vec(&rep) }
|
||||
pub fn respond_with<R: Request>(r: &R, f: impl FnOnce(&R) -> R::Response) -> Vec<u8> {
|
||||
respond(r, f(r))
|
||||
}
|
||||
|
||||
pub trait Channel: 'static {
|
||||
|
||||
Reference in New Issue
Block a user