inline analysis and symbol reduction; emits smaller than 64 bytes marked inline

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-03 20:06:43 +00:00
parent 1e8b8cce0f
commit eeda96d94a
35 changed files with 117 additions and 73 deletions

View file

@ -11,21 +11,19 @@ pub type Key = [Byte];
pub(crate) type Byte = u8;
impl OwnedKeyVal {
#[inline]
#[must_use]
pub fn as_slice(&self) -> KeyVal<'_> { KeyVal(&self.0, &self.1) }
#[inline]
#[must_use]
pub fn to_tuple(self) -> OwnedKeyValPair { (self.0, self.1) }
}
impl From<OwnedKeyValPair> for OwnedKeyVal {
#[inline]
fn from((key, val): OwnedKeyValPair) -> Self { Self(key, val) }
}
impl From<&KeyVal<'_>> for OwnedKeyVal {
#[inline]
fn from(slice: &KeyVal<'_>) -> Self { slice.to_owned() }
}
@ -34,7 +32,6 @@ impl From<KeyValPair<'_>> for OwnedKeyVal {
}
impl From<OwnedKeyVal> for OwnedKeyValPair {
#[inline]
fn from(val: OwnedKeyVal) -> Self { val.to_tuple() }
}
@ -43,22 +40,18 @@ impl KeyVal<'_> {
#[must_use]
pub fn to_owned(&self) -> OwnedKeyVal { OwnedKeyVal::from(self) }
#[inline]
#[must_use]
pub fn as_tuple(&self) -> KeyValPair<'_> { (self.0, self.1) }
}
impl<'a> From<&'a OwnedKeyVal> for KeyVal<'a> {
#[inline]
fn from(owned: &'a OwnedKeyVal) -> Self { owned.as_slice() }
}
impl<'a> From<&'a OwnedKeyValPair> for KeyVal<'a> {
#[inline]
fn from((key, val): &'a OwnedKeyValPair) -> Self { KeyVal(key.as_slice(), val.as_slice()) }
}
impl<'a> From<KeyValPair<'a>> for KeyVal<'a> {
#[inline]
fn from((key, val): KeyValPair<'a>) -> Self { KeyVal(key, val) }
}