Add some must_use to jemalloc-ctl key APIs

This commit is contained in:
gnzlbg 2019-11-28 17:26:45 +01:00
parent 562a530b83
commit 61f653fe6c
3 changed files with 4 additions and 0 deletions

View File

@ -88,6 +88,7 @@ impl Name {
/// Returns `true` if `self` is a key in the _MALLCTL NAMESPCE_ referring to
/// a null-terminated string.
#[must_use]
pub fn value_type_str(&self) -> bool {
// remove the null-terminator:
let name = self.0.split_at(self.0.len() - 1).0;
@ -117,6 +118,7 @@ impl Name {
}
/// Returns the name as null-terminated byte-string.
#[must_use]
pub fn as_bytes(&self) -> &'static [u8] {
unsafe { &*(self as *const Self as *const [u8]) }
}

View File

@ -27,6 +27,7 @@ macro_rules! types {
}
/// Key [`::keys::Name`].
#[must_use]
pub fn name() -> &'static ::keys::Name {
Self::NAME
}

View File

@ -127,6 +127,7 @@ where
{
/// Returns the current value at the pointer.
#[inline]
#[must_use]
pub fn get(self) -> T {
unsafe { *self.0 }
}