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

Method build

plugins/lsps-plugin/src/core/server.rs:51–75  ·  view source on GitHub ↗
(mut self)

Source from the content-addressed store, hash-verified

49 }
50
51 pub fn build(mut self) -> LspsService {
52 self.supported_protocols.sort();
53 self.supported_protocols.dedup();
54 let supported_protocols: Vec<u8> = self
55 .supported_protocols
56 .into_iter()
57 .filter(|&p| p != 0)
58 .collect();
59
60 let protocols_for_rpc = supported_protocols.clone();
61 self.router_builder.register(
62 "lsps0.list_protocols",
63 move |_p: Lsps0listProtocolsRequest| {
64 let protocols = protocols_for_rpc.clone();
65 async move { Ok(Lsps0listProtocolsResponse { protocols }) }
66 },
67 );
68
69 let router = self.router_builder.build();
70
71 LspsService {
72 router,
73 supported_protocols,
74 }
75 }
76}
77
78#[cfg(test)]

Callers 6

newMethod · 0.45
test_protocols_sortedFunction · 0.45
test_protocols_dedupedFunction · 0.45

Calls 2

sortMethod · 0.80
registerMethod · 0.80

Tested by 5

test_protocols_sortedFunction · 0.36
test_protocols_dedupedFunction · 0.36