fn poll(nseconds: u64, channel: &str) -> Option<Slate> {
	let start = Instant::now();
	println!("Waiting for message from {}...", channel);
	while start.elapsed().as_secs() < nseconds {
		let unread = read_from_channel(channel, SLATE_SIGNED);
		for msg in unread.iter() {
			let blob = from_str::<Slate>(msg);
			match blob {
				Ok(slate) => {
					println!("Received message from {}", channel);
					return Some(slate);
				}
				Err(_) => (),
			}
		}
		sleep(SLEEP_DURATION);
	}
	println!(
		"Did not receive reply from {} in {} seconds",
		channel, nseconds
	);
	None
}
/// Listen for a message from a specific channel with topic SLATE_SIGNED for nseconds and return the first valid slate.
Listen for a message from a specific channel with topic SLATE_SIGNED for nseconds and return the first valid slate.
Listen for a message from a specific channel with topic SLATE_SIGNED for nseconds and return the first valid slate .
fn poll(nseconds: u64, channel: &str) -> Option<Slate> {
	let start = Instant::now();
	println!("Waiting for message from {}...", channel);
	while start.elapsed().as_secs() < nseconds {
		let unread = read_from_channel(channel, SLATE_SIGNED);
		for msg in unread.iter() {
			let blob = from_str::<Slate>(msg);
			match blob {
				Ok(slate) => {
					println!("Received message from {}", channel);
					return Some(slate);
				}
				Err(_) => (),
			}
		}
		sleep(SLEEP_DURATION);
	}
	println!(
		"Did not receive reply from {} in {} seconds",
		channel, nseconds
	);
	None
}
fn poll ( nseconds : u64 , channel : & str ) -> Option < Slate > { let start = Instant :: now ( ) ; println ! ( " " channel ) ; while start . elapsed ( ) . as_secs ( ) < nseconds { let unread = read_from_channel ( channel , SLATE_SIGNED ) ; for msg in unread . iter ( ) { let blob = from_str :: < Slate > ( msg ) ; match blob { Ok ( slate ) => { println ! ( " " channel ) ; return Some ( slate ) ; } Err ( _ ) => ( ) , } } sleep ( SLEEP_DURATION ) ; } println ! ( " " channel nseconds ) ; None }
Listen for a message from a specific channel with topic SLATE_SIGNED for nseconds and return the first valid slate.
Listen for a message from a specific channel with topic SLATE_SIGNED for nseconds and return the first valid slate .
nseconds
u64
channel
&str