from implementation to conveniently make SendQueue from (Token, Into<String>)

master
rasul 5 years ago
parent 77a5df67d8
commit c963514967

@ -42,6 +42,13 @@ impl RecvQueue {
#[derive(Debug)] #[derive(Debug)]
pub struct SendQueue(pub VecDeque<(Token, String, bool, Option<State>)>); pub struct SendQueue(pub VecDeque<(Token, String, bool, Option<State>)>);
impl<S: Into<String>> From<(Token, S)> for SendQueue {
fn from(tuple: (Token, S)) -> Self {
let (t, s) = tuple;
Self(vec![(t, s.into(), true, None)].into())
}
}
impl SendQueue { impl SendQueue {
pub fn new() -> Self { pub fn new() -> Self {
SendQueue(VecDeque::new()) SendQueue(VecDeque::new())

Loading…
Cancel
Save