MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / show_parameter

Method show_parameter

nodedb-client/src/native/connection/mod.rs:323–347  ·  view source on GitHub ↗

Show a session parameter.

(&mut self, key: &str)

Source from the content-addressed store, hash-verified

321
322 /// Show a session parameter.
323 pub async fn show_parameter(&mut self, key: &str) -> NodeDbResult<String> {
324 let resp = self
325 .send(
326 OpCode::Show,
327 TextFields {
328 key: Some(key.to_string()),
329 ..Default::default()
330 },
331 )
332 .await?;
333 if resp.status == ResponseStatus::Error {
334 let msg = resp
335 .error
336 .map(|e| e.message)
337 .unwrap_or_else(|| "show failed".into());
338 return Err(NodeDbError::internal(msg));
339 }
340 let value = resp
341 .rows
342 .and_then(|rows| rows.into_iter().next())
343 .and_then(|row| row.into_iter().next())
344 .and_then(|v| v.as_str().map(String::from))
345 .unwrap_or_default();
346 Ok(value)
347 }
348
349 fn next_seq(&self) -> u64 {
350 self.seq.fetch_add(1, Ordering::Relaxed)

Callers

nothing calls this directly

Calls 5

to_stringMethod · 0.80
internalFunction · 0.50
sendMethod · 0.45
nextMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected