pub enum Handle {
Null,
Pseudo(PseudoHandle),
Thread(ThreadId),
}
Expand description
Miri representation of a Windows HANDLE
Variants§
Implementations§
Source§impl Handle
impl Handle
const NULL_DISCRIMINANT: u32 = 0u32
const PSEUDO_DISCRIMINANT: u32 = 1u32
const THREAD_DISCRIMINANT: u32 = 2u32
fn discriminant(self) -> u32
fn data(self) -> u32
fn packed_disc_size() -> u32
Sourcefn to_packed(self) -> u32
fn to_packed(self) -> u32
Converts a handle into its machine representation.
The upper Self::packed_disc_size()
bits are used to store a discriminant corresponding to the handle variant.
The remaining bits are used for the variant’s field.
None of this layout is guaranteed to applications by Windows or Miri.
fn new(discriminant: u32, data: u32) -> Option<Self>
Sourcefn from_packed(handle: u32) -> Option<Self>
fn from_packed(handle: u32) -> Option<Self>
see docs for to_packed
pub fn to_scalar(self, cx: &impl HasDataLayout) -> Scalar
Sourcepub fn try_from_scalar<'tcx>(
handle: Scalar,
cx: &MiriInterpCx<'tcx>,
) -> InterpResult<'tcx, Result<Self, HandleError>>
pub fn try_from_scalar<'tcx>( handle: Scalar, cx: &MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<Self, HandleError>>
Convert a scalar into a structured Handle
.
Structurally invalid handles return HandleError::InvalidHandle
.
If the handle is structurally valid but semantically invalid, e.g. a for non-existent thread
ID, returns HandleError::ThreadNotFound
.
Trait Implementations§
impl Copy for Handle
impl Eq for Handle
impl StructuralPartialEq for Handle
Auto Trait Implementations§
impl Freeze for Handle
impl RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnwindSafe for Handle
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes
Size for each variant:
Null
: 0 bytesPseudo
: 4 bytesThread
: 4 bytes