MCPcopy Create free account
hub / github.com/ElementsProject/lightning / hook

Method hook

plugins/src/lib.rs:161–174  ·  view source on GitHub ↗

Add a subscription to a given `hookname`

(mut self, hookname: &str, callback: C)

Source from the content-addressed store, hash-verified

159
160 /// Add a subscription to a given `hookname`
161 pub fn hook<C, F>(mut self, hookname: &str, callback: C) -> Self
162 where
163 C: Send + Sync + 'static,
164 C: Fn(Plugin<S>, Request) -> F + 'static,
165 F: Future<Output = Response> + Send + Sync + 'static,
166 {
167 self.hooks.insert(
168 hookname.to_string(),
169 Hook {
170 callback: Box::new(move |p, r| Box::pin(callback(p, r))),
171 },
172 );
173 self
174 }
175
176 /// Register a custom RPC method for the RPC passthrough from the
177 /// main daemon

Callers 1

mainFunction · 0.45

Calls 1

to_stringMethod · 0.80

Tested by

no test coverage detected