Function collectd_plugin::from_array
source · Expand description
Turns a fixed size character array into string slice, if possible
Examples
use collectd_plugin::from_array;
use collectd_plugin::bindings::ARR_LENGTH;
use std::os::raw::c_char;
let mut name: [c_char; ARR_LENGTH] = [0; ARR_LENGTH];
name[0] = b'h' as c_char;
name[1] = b'i' as c_char;
assert_eq!(Ok("hi"), from_array(&name));