We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider allowing multiple trait implementations on a module.
trait ContractDef { fn def() -> Vec<String>; } // #[odra::interface] trait ERC20Interface { fn transfer(&mut self); fn balance_of(&self); } // #[autogenerated] impl ContractDef for dyn ERC20Interface { fn def() -> Vec<String> { vec![ String::from("transfer"), String::from("balance_of") ] } } // #[odra::interface] trait ERC20MetadataInterface { fn name(&self); } // #[autogenerated] impl ContractDef for dyn ERC20MetadataInterface { fn def() -> Vec<String> { vec![ String::from("name"), ] } } // #[odra::module] struct Token; impl ERC20Interface for Token { fn transfer(&mut self) {} fn balance_of(&self) {} } impl ERC20MetadataInterface for Token { fn name(&self) {} } // #[autogenerated] impl ContractDef for Token { fn def() -> Vec<String> { let mut def = Vec::new(); def.extend_from_slice(&<dyn ERC20Interface as ContractDef>::def()); def.extend_from_slice(&<dyn ERC20MetadataInterface as ContractDef>::def()); def } } #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { assert_eq!(Token::def(), vec![ String::from("transfer"), String::from("balance_of"), String::from("name"), ]); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Consider allowing multiple trait implementations on a module.
The text was updated successfully, but these errors were encountered: