rust/pv_core: Add From<Msb0Flags64> and From<Lsb0Flags64 for u64

That way it's possible to convert a u64 to (Msb|Lsb)0Flags64 and vice
versa.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2024-10-24 08:57:43 +00:00
committed by Steffen Eiden
parent 081a055115
commit cb0e119bed

View File

@@ -72,6 +72,12 @@ impl From<&u64> for Msb0Flags64 {
}
}
impl From<Msb0Flags64> for u64 {
fn from(value: Msb0Flags64) -> Self {
value.0.into()
}
}
/// Bitflags in LSB0 ordering
///
/// Wraps an u64 to set/get individual bits
@@ -114,6 +120,12 @@ impl From<&u64> for Lsb0Flags64 {
}
}
impl From<Lsb0Flags64> for u64 {
fn from(value: Lsb0Flags64) -> Self {
value.0.into()
}
}
/// Tries to convert a BE hex string into a 128 unsigned integer
/// The hexstring must contain 32chars of hexdigits
///