Skip to main content

Pmt

Struct Pmt 

Source
pub struct Pmt(/* private fields */);
Expand description

An object representing a Zircon Pinned Memory Token. See PMT Documentation for details.

As essentially a subtype of NullableHandle, it can be freely interconverted.

Implementations§

Source§

impl Pmt

Source

pub fn raw_handle(&self) -> u32

Return the handle’s integer value.

Source

pub fn invalid() -> Pmt

Source

pub fn is_invalid(&self) -> bool

Source

pub fn into_raw(self) -> u32

Return the raw handle’s integer value without closing it when self is dropped.

Source

pub fn unowned(&self) -> Unowned<'_, Pmt>

Returns an [Unowned] referring to this handle.

Source

pub fn as_handle_ref(&self) -> Unowned<'_, NullableHandle>

Returns a [HandleRef] referring to this handle.

Source

pub fn duplicate_handle(&self, rights: Rights) -> Result<Pmt, Status>

Wraps the zx_handle_duplicate syscall.

Source

pub fn replace_handle(self, rights: Rights) -> Result<Pmt, Status>

Wraps the zx_handle_replace syscall.

Source

pub fn into_handle(self) -> NullableHandle

Converts the value into its inner handle.

Source

pub fn signal( &self, clear_mask: Signals, set_mask: Signals, ) -> Result<(), Status>

Wraps the zx_object_signal syscall.

Source

pub fn wait_one( &self, signals: Signals, deadline: Instant<MonotonicTimeline>, ) -> WaitResult

Wraps the zx_object_wait_one syscall.

Source

pub fn wait_async( &self, port: &Port, key: u64, signals: Signals, options: WaitAsyncOpts, ) -> Result<(), Status>

Wraps the zx_object_wait_async syscall.

Source

pub fn wait_item(&self, signals: Signals) -> WaitItem<'_>

Return a WaitItem for this handle and the provided signals to use with object_wait_many.

Source

pub fn get_name(&self) -> Result<Name, Status>

Wraps a call to the zx_object_get_property syscall for the ZX_PROP_NAME property.

Source

pub fn set_name(&self, name: &Name) -> Result<(), Status>

Wraps a call to the zx_object_set_property syscall for the ZX_PROP_NAME property.

Source

pub fn basic_info(&self) -> Result<HandleBasicInfo, Status>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_BASIC topic.

Source

pub fn count_info(&self) -> Result<HandleCountInfo, Status>

Wraps the zx_object_get_info syscall for the ZX_INFO_HANDLE_COUNT topic.

Source

pub fn koid(&self) -> Result<Koid, Status>

Returns the [Koid] for the object referred to by this handle.

Source§

impl Pmt

Source

pub unsafe fn unpin(self) -> Result<(), Status>

Unpins a Pinned Memory Token. Wraps the zx_pmt_unpin system call to unpin a pmt.

This function is marked unsafe because calling it at the wrong time (i.e., while hardware is still accessing the pinned memory) can lead to memory corruption.

§Safety

The caller must ensure hardware is no longer accessing the memory that has been pinned or else risk arbitrary memory corruption. It is strongly recommended you do not call this in a drop method.

Trait Implementations§

Source§

impl AsHandleRef for Pmt

Source§

fn as_handle_ref(&self) -> Unowned<'_, NullableHandle>

Get a reference to the handle. One important use of such a reference is for object_wait_many.
Source§

impl Debug for Pmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<Handle> for Pmt

Source§

fn from(handle: Handle) -> Pmt

Converts to this type from the input type.
Source§

impl From<NullableHandle> for Pmt

Source§

fn from(handle: NullableHandle) -> Pmt

Converts to this type from the input type.
Source§

impl From<Pmt> for NullableHandle

Source§

fn from(x: Pmt) -> NullableHandle

Converts to this type from the input type.
Source§

impl Hash for Pmt

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Pmt

Source§

fn cmp(&self, other: &Pmt) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Pmt

Source§

fn eq(&self, other: &Pmt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Pmt

Source§

fn partial_cmp(&self, other: &Pmt) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Eq for Pmt

Source§

impl StructuralPartialEq for Pmt

Auto Trait Implementations§

§

impl Freeze for Pmt

§

impl RefUnwindSafe for Pmt

§

impl Send for Pmt

§

impl Sync for Pmt

§

impl Unpin for Pmt

§

impl UnsafeUnpin for Pmt

§

impl UnwindSafe for Pmt

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> EncodableAsHandle for T

Source§

type Dialect = DefaultFuchsiaResourceDialect

What resource dialect can encode this object as a handle.
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.