Guest User

Untitled

a guest
Aug 19th, 2019
60
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mod amethyst {
  2.  
  3. pub struct Builder;
  4.  
  5. impl Builder {
  6.  
  7. pub fn with_resource(self) -> Self {
  8. self
  9. }
  10. }
  11. }
  12.  
  13. mod phythyst {
  14.  
  15. pub trait PhythystBuilderExt: Sized {
  16. fn with_physics(self, physics: usize) -> Self;
  17. }
  18.  
  19. impl PhythystBuilderExt for crate::amethyst::Builder {
  20. fn with_physics(self, _physics: usize) -> Self {
  21. println!("Here you can register stuff!");
  22. self
  23. }
  24. }
  25.  
  26. }
  27.  
  28.  
  29. fn main() {
  30. use phythyst::PhythystBuilderExt;
  31.  
  32. let _x = amethyst::Builder
  33. .with_resource()
  34. // voilá
  35. .with_physics(0);
  36. }
RAW Paste Data