Searched refs:string_from_cstr (Results 1 – 3 of 3) sorted by relevance
2 use super::string_from_cstr;94 driver: string_from_cstr(&qcap.driver).unwrap_or_else(|_| "".into()), in from()95 card: string_from_cstr(&qcap.card).unwrap_or_else(|_| "".into()), in from()96 bus_info: string_from_cstr(&qcap.bus_info).unwrap_or_else(|_| "".into()), in from()
2 use super::string_from_cstr;57 description: string_from_cstr(&fmtdesc.description).unwrap_or_else(|_| "".into()), in from()
127 fn string_from_cstr(c_str: &[u8]) -> Result<String, FromBytesWithNulError> { in string_from_cstr() function1139 use super::string_from_cstr; in test_string_from_cstr()1142 assert_eq!(string_from_cstr(b"Hello\0"), Ok(String::from("Hello"))); in test_string_from_cstr()1145 assert_eq!(string_from_cstr(b"Hi\0lo"), Ok(String::from("Hi"))); in test_string_from_cstr()1148 assert_eq!(string_from_cstr(b"Hi\0lo\0"), Ok(String::from("Hi"))); in test_string_from_cstr()1151 assert_eq!(string_from_cstr(b"\0ello"), Ok(String::from(""))); in test_string_from_cstr()1154 match string_from_cstr(b"Hello") { in test_string_from_cstr()1160 match string_from_cstr(b"") { in test_string_from_cstr()