RemotePointer

Struct RemotePointer 

Source
pub struct RemotePointer<T: Sized> { /* private fields */ }
Expand description

A safe wrapper around a pointer allocated by COM.

This struct ensures proper cleanup of COM-allocated memory when dropped. It provides methods to access the underlying pointer.

Implementations§

Source§

impl<T: Sized> RemotePointer<T>

Source

pub fn null() -> Self

Creates a new RemotePointer initialized to null.

Source

pub fn as_mut_ptr(&mut self) -> *mut *mut T

Source

pub fn as_ref(&self) -> Option<&T>

Returns an Option referencing the inner value if it is not null.

§Safety

The caller must ensure that the inner pointer is valid for reads.

Source

pub fn ok(&self) -> Result<&T>

Source

pub fn from_option<R: Into<RemotePointer<T>>>(value: Option<R>) -> Self

Source§

impl RemotePointer<u16>

Source

pub fn as_mut_pwstr_ptr(&mut self) -> *mut PWSTR

Returns a mutable pointer to a PWSTR.

Trait Implementations§

Source§

impl<T: Clone + Sized> Clone for RemotePointer<T>

Source§

fn clone(&self) -> RemotePointer<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Sized> Debug for RemotePointer<T>

Source§

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

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

impl<T: Sized> Default for RemotePointer<T>

Source§

fn default() -> Self

Creates a new RemotePointer initialized to null by default.

Source§

impl<T: Sized> Drop for RemotePointer<T>

Source§

fn drop(&mut self)

Drops the RemotePointer, freeing the COM-allocated memory.

Source§

impl From<&str> for RemotePointer<u16>

Source§

fn from(value: &str) -> Self

Converts a string slice to a RemotePointer<u16>.

Source§

impl From<PWSTR> for RemotePointer<u16>

Source§

fn from(value: PWSTR) -> Self

Converts a PWSTR to a RemotePointer<u16>.

Source§

impl<T: PartialEq + Sized> PartialEq for RemotePointer<T>

Source§

fn eq(&self, other: &RemotePointer<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 TryFrom<RemotePointer<u16>> for Option<String>

Source§

fn try_from(value: RemotePointer<u16>) -> Result<Self, Self::Error>

Attempts to convert a RemotePointer<u16> to an Option<String>.

§Errors

Returns an error if the string conversion fails.

Source§

type Error = Error

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

impl TryFrom<RemotePointer<u16>> for String

Source§

fn try_from(value: RemotePointer<u16>) -> Result<Self, Self::Error>

Attempts to convert a RemotePointer<u16> to a String.

§Errors

Returns an error if the pointer is null or if the string conversion fails.

Source§

type Error = Error

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

impl<T: Sized> StructuralPartialEq for RemotePointer<T>

Auto Trait Implementations§

§

impl<T> Freeze for RemotePointer<T>

§

impl<T> RefUnwindSafe for RemotePointer<T>
where T: RefUnwindSafe,

§

impl<T> !Send for RemotePointer<T>

§

impl<T> !Sync for RemotePointer<T>

§

impl<T> Unpin for RemotePointer<T>

§

impl<T> UnwindSafe for RemotePointer<T>
where T: RefUnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.