Add some must_use to jemalloc-ctl key APIs
This commit is contained in:
parent
562a530b83
commit
61f653fe6c
|
@ -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]) }
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ macro_rules! types {
|
|||
}
|
||||
|
||||
/// Key [`::keys::Name`].
|
||||
#[must_use]
|
||||
pub fn name() -> &'static ::keys::Name {
|
||||
Self::NAME
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ where
|
|||
{
|
||||
/// Returns the current value at the pointer.
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn get(self) -> T {
|
||||
unsafe { *self.0 }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue