From 90f20f8c539843f53a7a2b1cfb83b3673ec78534 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 22 Dec 2018 12:13:20 +0300 Subject: less verbose debug --- crates/gen_lsp_server/src/msg.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/gen_lsp_server') diff --git a/crates/gen_lsp_server/src/msg.rs b/crates/gen_lsp_server/src/msg.rs index af901d0d2..f68cbc541 100644 --- a/crates/gen_lsp_server/src/msg.rs +++ b/crates/gen_lsp_server/src/msg.rs @@ -152,12 +152,18 @@ impl RawNotification { params: to_value(params).unwrap(), } } + pub fn is(&self) -> bool + where + N: Notification, + { + self.method == N::METHOD + } pub fn cast(self) -> ::std::result::Result where N: Notification, N::Params: serde::de::DeserializeOwned, { - if self.method != N::METHOD { + if !self.is::() { return Err(self); } Ok(from_value(self.params).unwrap()) -- cgit v1.2.3