Struct mycelium_kernel::arch::interrupt::SelectorErrorCode
source · pub struct SelectorErrorCode(/* private fields */);
Expand description
Error code set by the “Invalid TSS”, “Segment Not Present”, “Stack-Segment Fault”, and “General Protection Fault” faults.
This includes a segment selector index, and includes 2 bits describing which table the segment selector references.
Implementations§
source§impl SelectorErrorCode
impl SelectorErrorCode
sourcepub const fn from_bits(bits: u16) -> SelectorErrorCode
pub const fn from_bits(bits: u16) -> SelectorErrorCode
Constructs a new instance of Self
from the provided raw bits.
sourcepub const fn new() -> SelectorErrorCode
pub const fn new() -> SelectorErrorCode
Constructs a new instance of Self
with all bits set to 0.
sourcepub fn with<T>(
self,
field: Pack16<T, SelectorErrorCode>,
value: T
) -> SelectorErrorCode
pub fn with<T>( self, field: Pack16<T, SelectorErrorCode>, value: T ) -> SelectorErrorCode
Packs the bit representation of value
into self
at the bit
range designated by field
, returning a new bitfield.
sourcepub fn set<T>(
&mut self,
field: Pack16<T, SelectorErrorCode>,
value: T
) -> &mut SelectorErrorCode
pub fn set<T>( &mut self, field: Pack16<T, SelectorErrorCode>, value: T ) -> &mut SelectorErrorCode
Packs the bit representation of value
into self
at the range
designated by field
, mutating self
in place.
sourcepub fn get<T>(self, field: Pack16<T, SelectorErrorCode>) -> T
pub fn get<T>(self, field: Pack16<T, SelectorErrorCode>) -> T
Unpacks the bit range represented by field
from self
, and
converts it into a T
-typed value.
Panics
This method panics if self
does not contain a valid bit
pattern for a T
-typed value, as determined by T
’s
FromBits::try_from_bits
implementation.
sourcepub fn try_get<T>(
self,
field: Pack16<T, SelectorErrorCode>
) -> Result<T, <T as FromBits<u16>>::Error>
pub fn try_get<T>( self, field: Pack16<T, SelectorErrorCode> ) -> Result<T, <T as FromBits<u16>>::Error>
Unpacks the bit range represented by field
from self
and attempts to convert it into a T
-typed value.
Returns
Ok(T)
if aT
-typed value could be constructed from the bits insrc
Err(T::Error)
ifsrc
does not contain a valid bit pattern for aT
-typed value, as determined byT
’s [FromBits::try_from_bits
implementation.
sourcepub fn assert_valid()
pub fn assert_valid()
Asserts that all the packing specs for this type are valid.
This is intended to be used in unit tests.
sourcepub fn display_ascii(&self) -> impl Display
pub fn display_ascii(&self) -> impl Display
Returns a value that formats this bitfield in a multi-line format, using only ASCII characters.
This is equivalent to formatting this bitfield using a {}
display specifier, but will never use Unicode box-drawing
characters, even when an upstream formatter uses the {:#}
fmt::Display
specifier. This is intended for use on platforms
where Unicode box drawing characters are never available.
sourcepub fn display_unicode(&self) -> impl Display
pub fn display_unicode(&self) -> impl Display
Returns a value that formats this bitfield in a multi-line format, always using Unicode box-drawing characters.
This is equivalent to formatting this bitfield using a {:#}
format specifier, but will always use Unicode box-drawing
characters, even when an upstream formatter uses the {}
fmt::Display
specifier.
Trait Implementations§
source§impl Binary for SelectorErrorCode
impl Binary for SelectorErrorCode
source§impl Clone for SelectorErrorCode
impl Clone for SelectorErrorCode
source§fn clone(&self) -> SelectorErrorCode
fn clone(&self) -> SelectorErrorCode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SelectorErrorCode
impl Debug for SelectorErrorCode
source§impl Display for SelectorErrorCode
impl Display for SelectorErrorCode
source§impl From<u16> for SelectorErrorCode
impl From<u16> for SelectorErrorCode
source§fn from(val: u16) -> SelectorErrorCode
fn from(val: u16) -> SelectorErrorCode
source§impl LowerHex for SelectorErrorCode
impl LowerHex for SelectorErrorCode
source§impl UpperHex for SelectorErrorCode
impl UpperHex for SelectorErrorCode
impl Copy for SelectorErrorCode
Auto Trait Implementations§
impl RefUnwindSafe for SelectorErrorCode
impl Send for SelectorErrorCode
impl Sync for SelectorErrorCode
impl Unpin for SelectorErrorCode
impl UnwindSafe for SelectorErrorCode
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
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.