Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub trait Engine {}
- pub trait GpuEngine: Engine {}
- pub struct MyEngine {}
- impl Engine for MyEngine {}
- impl GpuEngine for MyEngine {}
- pub struct OtherEngine {}
- impl Engine for OtherEngine {}
- #[cfg(not(eature = "gpu-engine"))]
- pub fn use_engine(engine: impl Engine) {
- // do sth cool with that engine
- }
- #[cfg(feature = "gpu-engine")]
- pub fn use_engine(engine: impl GpuEngine) {
- // do sth cool with that gpu engine
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement