Updated as per review comments
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							0a4bd393ec
						
					
				
				
					commit
					ad7ffa795f
				
			| @@ -7,16 +7,15 @@ pub mod assert; | ||||
| pub mod raw; | ||||
|  | ||||
| pub mod frames; | ||||
| pub mod prelude; | ||||
| pub mod mock; | ||||
| pub mod mock_io; | ||||
| pub mod notify; | ||||
| pub mod prelude; | ||||
| pub mod util; | ||||
|  | ||||
| mod client_ext; | ||||
| mod future_ext; | ||||
|  | ||||
| pub use crate::client_ext::{SendRequestExt}; | ||||
| pub use crate::client_ext::SendRequestExt; | ||||
| pub use crate::future_ext::TestFuture; | ||||
|  | ||||
| pub type WindowSize = usize; | ||||
|   | ||||
| @@ -1,53 +0,0 @@ | ||||
| use std::sync::Arc; | ||||
| use std::sync::atomic::AtomicBool; | ||||
| use std::sync::atomic::Ordering::SeqCst; | ||||
|  | ||||
| pub struct MockNotify { | ||||
|     inner: Arc<Inner>, | ||||
| } | ||||
|  | ||||
| struct Inner { | ||||
|     notified: AtomicBool, | ||||
| } | ||||
|  | ||||
| impl MockNotify { | ||||
|     pub fn new() -> Self { | ||||
|         MockNotify { | ||||
|             inner: Arc::new(Inner { | ||||
|                 notified: AtomicBool::new(false), | ||||
|             }), | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     pub fn with<F: FnOnce() -> R, R>(&self, _f: F) -> R { | ||||
|         unimplemented!(); | ||||
|         // use futures::future::poll_fn; | ||||
|  | ||||
|         // self.clear(); | ||||
|  | ||||
|         // let mut f = Some(f); | ||||
|  | ||||
|         // let res = tokio::spawn(poll_fn(move |cx| { | ||||
|         //     Poll::Ready(f.take().unwrap()()) | ||||
|         // })).poll_future_notify(&self.inner, 0); | ||||
|  | ||||
|         // match res { | ||||
|         //     Poll::Ready(v) => v, | ||||
|         //     _ => unreachable!(), | ||||
|         // } | ||||
|     } | ||||
|  | ||||
|     pub fn clear(&self) { | ||||
|         self.inner.notified.store(false, SeqCst); | ||||
|     } | ||||
|  | ||||
|     pub fn is_notified(&self) -> bool { | ||||
|         self.inner.notified.load(SeqCst) | ||||
|     } | ||||
| } | ||||
|  | ||||
| // impl Notify for Inner { | ||||
| //     fn notify(&self, _: usize) { | ||||
| //         self.notified.store(true, SeqCst); | ||||
| //     } | ||||
| // } | ||||
| @@ -12,9 +12,6 @@ pub use super::mock::{self, idle_ms}; | ||||
| // Re-export frames helpers | ||||
| pub use super::frames; | ||||
|  | ||||
| // Re-export mock notify | ||||
| pub use super::notify::MockNotify; | ||||
|  | ||||
| // Re-export utility mod | ||||
| pub use super::util; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user