aboutsummaryrefslogtreecommitdiff
path: root/crates/server/src/dispatch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/server/src/dispatch.rs')
-rw-r--r--crates/server/src/dispatch.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/server/src/dispatch.rs b/crates/server/src/dispatch.rs
index 2da0996e3..d9681db40 100644
--- a/crates/server/src/dispatch.rs
+++ b/crates/server/src/dispatch.rs
@@ -136,6 +136,18 @@ pub fn handle_notification<N, F>(not: &mut Option<RawNotification>, f: F) -> Res
136 } 136 }
137} 137}
138 138
139pub fn send_notification<N>(io: &mut Io, params: N::Params) -> Result<()>
140 where
141 N: Notification,
142 N::Params: Serialize
143{
144 io.send(RawMsg::Notification(RawNotification {
145 method: N::METHOD.to_string(),
146 params: serde_json::to_value(params)?,
147 }));
148 Ok(())
149}
150
139 151
140pub fn unknown_method(io: &mut Io, raw: RawRequest) -> Result<()> { 152pub fn unknown_method(io: &mut Io, raw: RawRequest) -> Result<()> {
141 error(io, raw.id, ErrorCode::MethodNotFound, "unknown method") 153 error(io, raw.id, ErrorCode::MethodNotFound, "unknown method")