extern crate intercom; extern crate log; extern crate simple_logger; use submodule::ISubInterface; #[intercom::com_class(IInterface, ISubInterface)] struct S; #[intercom::com_interface] trait IInterface { fn call(&self); } #[intercom::com_interface] trait IAnotherInterface { } impl IInterface for S { fn call(&self) { println!("Call"); } } mod submodule { use super::*; #[intercom::com_interface] pub trait ISubInterface { } impl ISubInterface for S {} } fn main() { simple_logger::init().unwrap(); log::info!("Acquire S as IInterface"); let combox = intercom::ComBox::new(S); let rc: intercom::ComRc = intercom::ComRc::from(combox); log::info!("Call IInterface::call"); rc.call(); log::info!("Query ISubInterface"); let _: intercom::ComRc = intercom::ComItf::query_interface(&rc).unwrap(); log::info!("Query IAnotherInterface"); let rc: intercom::ComResult> = intercom::ComItf::query_interface(&rc); log::info!("Cleanup"); }