From c963514967b1fb1c21e325d1f1fe7a1d0fac3f92 Mon Sep 17 00:00:00 2001 From: rasul Date: Tue, 7 Apr 2020 13:14:52 -0500 Subject: [PATCH] from implementation to conveniently make SendQueue from (Token, Into) --- src/queue.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/queue.rs b/src/queue.rs index 5c2a5fc..636d553 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -42,6 +42,13 @@ impl RecvQueue { #[derive(Debug)] pub struct SendQueue(pub VecDeque<(Token, String, bool, Option)>); +impl> 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 { pub fn new() -> Self { SendQueue(VecDeque::new())