MCPcopy Create free account
hub / github.com/corosync/corosync / string_to_cstring_validated

Function string_to_cstring_validated

bindings/rust/src/cmap.rs:289–298  ·  view source on GitHub ↗
(key: &str, maxlen: usize)

Source from the content-addressed store, hash-verified

287
288const CMAP_KEYNAME_MAXLENGTH: usize = 255;
289fn string_to_cstring_validated(key: &str, maxlen: usize) -> Result<CString> {
290 if maxlen > 0 && key.chars().count() >= maxlen {
291 return Err(CsError::CsErrInvalidParam);
292 }
293
294 match CString::new(key) {
295 Ok(n) => Ok(n),
296 Err(_) => Err(CsError::CsErrLibrary),
297 }
298}
299
300fn set_value(
301 handle: &Handle,

Callers 8

set_valueFunction · 0.85
set_stringFunction · 0.85
setFunction · 0.85
getFunction · 0.85
incFunction · 0.85
decFunction · 0.85
track_addFunction · 0.85
newMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected