publish client-sdk-native (#12)
* Create README.md * add example * crates & examples * fix syntax * add LICENSE * thirdparty LICENSE * rearrange repo * fix build * egui versions * prepare publish * fix demo compilation * add test ci * Update rust.yml * forgot runs-on * install protoc before building * avoid rate limit * include submodules * updates to readme * cache rust builds Co-authored-by: David Zhao <[email protected]> Co-authored-by: David Zhao <[email protected]>
This commit is contained in:
co-authored by
David Zhao
David Zhao
parent
a927baac94
commit
a07b3451a3
@@ -0,0 +1,27 @@
|
||||
|
||||
// TODO(theomonnom): Match the complete function signature like:
|
||||
// - pub(crate) fn update_info(&self, info: ParticipantInfo) -> ();
|
||||
#[macro_export]
|
||||
macro_rules! enum_dispatch {
|
||||
// This arm is used to avoid nested loops with the arguments
|
||||
// The arguments are transformed to $combined_args TokenTree
|
||||
(@match $self:ident $fnc:ident $combined_args:tt [$($variant:ident),+]) => {
|
||||
match $self {
|
||||
$(
|
||||
Self::$variant(inner) => inner.$fnc$combined_args,
|
||||
)+
|
||||
}
|
||||
};
|
||||
|
||||
($vis:vis$(,)? $fnc:ident, $self:ty, [$($arg:ident: $t:ty),*], $ret:ty, [$($variant:ident),+]) => {
|
||||
$vis fn $fnc(self: $self, $($arg: $t),*) -> $ret {
|
||||
enum_dispatch!(@match self $fnc ($($arg,)*) [$($variant),+])
|
||||
}
|
||||
};
|
||||
|
||||
($variants:tt $(fnc!($vis:vis$(,)? $fnc:ident, $self:ty, $args:tt, $ret:ty);)+) => {
|
||||
$(
|
||||
enum_dispatch!($vis, $fnc, $self, $args, $ret, $variants);
|
||||
)*
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user