mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
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:
committed by
Steffen Eiden
parent
081a055115
commit
cb0e119bed
@@ -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
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user