Lines Matching full:storage

42 //! // Convert to/from the backing storage type.
66 //! Signed integer storage types are not supported.
80 //! The macro generates the bitfield type, [`From`] and [`Into`] implementations for its storage
254 //! Bits of the storage type that are not part of any declared field are preserved by the setter
256 //! storage type.
280 //! Bitfield storage types are unsigned. Since field getter methods return a [`Bounded`] of the
281 //! storage type, fields are also unsigned by default.
295 $(#[$attr:meta])* $vis:vis struct $name:ident($storage:ty) { $($fields:tt)* }
299 $(#[$attr])* $vis $name $storage
301 $crate::bitfield!(@fields $vis $name $storage { $($fields)* });
306 // Defines the wrapper `$name` type and its conversions from/to the storage type.
307 (@core $(#[$attr:meta])* $vis:vis $name:ident $storage:ty) => {
312 inner: $storage,
319 $vis const fn from_raw(value: $storage) -> Self {
328 $vis const fn into_raw(self) -> $storage {
333 // SAFETY: `$storage` is `Zeroable` and `$name` is transparent.
336 impl ::core::convert::From<$name> for $storage {
338 fn from(val: $name) -> $storage {
343 impl ::core::convert::From<$storage> for $name {
345 fn from(val: $storage) -> $name {
353 (@fields $vis:vis $name:ident $storage:ty {
364 $crate::bitfield!(@private_field_accessors $vis $name $storage : $hi:$lo $field);
366 @public_field_accessors $(#[doc = $doc])* $vis $name $storage : $hi:$lo $field
378 @private_field_accessors $vis:vis $name:ident $storage:ty : $hi:tt:$lo:tt $field:ident
382 $vis const [<$field:upper _MASK>]: $storage =
390 ::kernel::num::Bounded<$storage, { $hi + 1 - $lo }> {
391 // Left shift to align the field's MSB with the storage MSB.
392 const ALIGN_TOP: u32 = $storage::BITS - ($hi + 1);
393 // Right shift to move the top-aligned field to bit 0 of the storage.
398 let val = ::kernel::num::Bounded::<$storage, { $storage::BITS }>::from(
407 value: ::kernel::num::Bounded<$storage, { $hi + 1 - $lo }>,
410 const MASK: $storage = <$name>::[<$field:upper _MASK>];
423 @public_field_accessors $(#[doc = $doc:expr])* $vis:vis $name:ident $storage:ty :
449 @public_field_accessors $(#[doc = $doc:expr])* $vis:vis $name:ident $storage:ty :
461 ::kernel::num::Bounded<$storage, { $hi + 1 - $lo }>
481 @public_field_accessors $(#[doc = $doc:expr])* $vis:vis $name:ident $storage:ty :
490 ::kernel::num::Bounded<$storage, { $hi + 1 - $lo }>
498 $vis const fn [<with_const_ $field>]<const VALUE: $storage>(self) -> Self {
500 ::kernel::num::Bounded::<$storage, { $hi + 1 - $lo }>::new::<VALUE>()
511 where T: ::core::convert::Into<::kernel::num::Bounded<$storage, { $hi + 1 - $lo }>>,
523 where T: ::kernel::num::TryIntoBounded<$storage, { $hi + 1 - $lo }>,