Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro_rules! mock_trait {
- ($trait_name:ident $(, $function_name:ident ( $(&self)* $(self)* $(, $prm_name:ident : $prm_type:ty)* ) $(-> $return_type:ty)* )* ) => {
- // Do I have an ability to access self or &self token here?
- trait $trait_name{
- $(
- fn $function_name(); // I am gonna put self or &self here
- )*
- }
- }
- }
- fn main() {
- mock_trait!(
- MyTrait,
- my_function(&self, prm1: &str, prm2: i32) -> &str,
- my_function2(self, prm1: &str,prm2: u64, prm3: i16) -> &str,
- my_function3(self, prm1: &str)
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement