Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. pub trait AsyncRead {}
  2. pub trait AsyncWrite {}
  3.  
  4. pub struct NoopStream;
  5.  
  6. impl AsyncRead for NoopStream {}
  7. impl AsyncWrite for NoopStream {}
  8.  
  9. pub trait Processor<T = NoopStream>
  10. where
  11. T: AsyncRead + AsyncWrite {}
  12.  
  13. pub struct NoopProcessor;
  14.  
  15. impl<T> Processor<T> for NoopProcessor
  16. where
  17. T: AsyncRead + AsyncWrite {}
  18.  
  19. pub struct Runner<P, RW>
  20. where
  21. P: Processor<RW>
  22. {
  23. processor: P,
  24. }
  25.  
  26. impl<P, RW> Runner<P, RW> {
  27. pub fn new(processor: P)
  28. where
  29. P: Processor<RW>,
  30. {
  31. Runner { processor, }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement