#[repr(transparent)]
pub struct UserPtr<T, P: Policy>(_, _);
Expand description

Raw pointer from user land.

Implementations

Checks if size is enough to save a value of T, then constructs a user pointer from its value addr.

Returns true if the pointer is null.

Calculates the offset from a pointer. count is in units of T; e.g., a count of 3 represents a pointer offset of 3 * size_of::<T>() bytes.

Returns the virtual address represented by the pointer.

Checks avaliability of the user pointer.

Returns [Ok(())] if it is neither null nor unaligned.

Converts to reference.

Reads the value from self without moving it. This leaves the memory in self unchanged.

Same as read, but returns None when pointer is null.

Forms a slice from a user pointer and a len.

Copies elements into a new Vec.

The len argument is the number of elements, not the number of bytes.

Forms an utf-8 string slice from a user pointer and a len.

Forms a zero-terminated string slice from a user pointer to a c style string.

Copies a group of zero-terminated string into Strings, and collect them into a Vec.

Overwrites a memory location with the given value without reading or dropping the old value.

Same as write, but does nothing and returns Ok when pointer is null.

Copies values.len() * size_of<T> bytes from values to self. The source and destination may not overlap.

Copies s to self, then write a '\0' for c style string.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

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

Casts the value.

Casts the value.

Casts the value.

Casts the value.

The resulting type after obtaining ownership.

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

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

Casts the value.

Casts the value.

Casts the value.