mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
less verbose debug
This commit is contained in:
parent
94241cec04
commit
90f20f8c53
2 changed files with 45 additions and 8 deletions
|
@ -152,12 +152,18 @@ impl RawNotification {
|
|||
params: to_value(params).unwrap(),
|
||||
}
|
||||
}
|
||||
pub fn is<N>(&self) -> bool
|
||||
where
|
||||
N: Notification,
|
||||
{
|
||||
self.method == N::METHOD
|
||||
}
|
||||
pub fn cast<N>(self) -> ::std::result::Result<N::Params, RawNotification>
|
||||
where
|
||||
N: Notification,
|
||||
N::Params: serde::de::DeserializeOwned,
|
||||
{
|
||||
if self.method != N::METHOD {
|
||||
if !self.is::<N>() {
|
||||
return Err(self);
|
||||
}
|
||||
Ok(from_value(self.params).unwrap())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue