pub struct ResourceSize(/* private fields */);Expand description
Resource size type.
This wraps either u32 or u64 depending on the config option
CONFIG_PHYS_ADDR_T_64BIT, and it can be a u64 even on 32-bit architectures.
§Examples
use kernel::io::ResourceSize;
let size = ResourceSize::from_raw(0x1000);
assert_eq!(size.into_raw(), 0x1000);
// Round-trips through the raw C type.
let raw: kernel::bindings::resource_size_t = size.into();
assert_eq!(ResourceSize::from(raw), size);
// Fallible conversion to `usize` (can truncate on 32-bit).
assert_eq!(usize::try_from(size)?, 0x1000);Implementations§
Trait Implementations§
Source§impl Clone for ResourceSize
impl Clone for ResourceSize
impl Copy for ResourceSize
Source§impl Debug for ResourceSize
impl Debug for ResourceSize
impl Eq for ResourceSize
Source§impl From<ResourceSize> for resource_size_t
impl From<ResourceSize> for resource_size_t
Source§fn from(value: ResourceSize) -> Self
fn from(value: ResourceSize) -> Self
Converts to this type from the input type.
Source§impl From<u64> for ResourceSize
impl From<u64> for ResourceSize
Source§impl Ord for ResourceSize
impl Ord for ResourceSize
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for ResourceSize
impl PartialEq for ResourceSize
Source§impl PartialOrd for ResourceSize
impl PartialOrd for ResourceSize
impl StructuralPartialEq for ResourceSize
Source§impl TryFrom<ResourceSize> for usize
impl TryFrom<ResourceSize> for usize
Source§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for ResourceSize
impl RefUnwindSafe for ResourceSize
impl Send for ResourceSize
impl Sync for ResourceSize
impl Unpin for ResourceSize
impl UnsafeUnpin for ResourceSize
impl UnwindSafe for ResourceSize
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
Source§fn into_safe_cast(self) -> T
fn into_safe_cast(self) -> T
Convert
self into a T. This operation is guaranteed to be lossless.Source§impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
Source§fn into_safe_cast_arch(self) -> T
fn into_safe_cast_arch(self) -> T
Convert
self into a T. This operation is guaranteed to be lossless.