pub struct ResidentOwner(/* private fields */);Expand description
Identity of one backend instance’s resident buffer namespace.
Resident buffer ids come from a counter private to a backend instance, so two live instances hand out the same ids for unrelated device memory. An owner makes those namespaces distinguishable, which is what lets a handle be checked instead of merely trusted.
Implementations§
Source§impl ResidentOwner
impl ResidentOwner
Sourcepub fn new() -> Result<Self, BackendError>
pub fn new() -> Result<Self, BackendError>
Mint an identity for a new backend instance.
§Errors
Returns BackendError::InvalidProgram if the process has exhausted
the owner id space, which is refused rather than wrapped: a wrapped id
would silently authorize a foreign handle.
Sourcepub fn handle(self, id: u64) -> ResidentHandle
pub fn handle(self, id: u64) -> ResidentHandle
Mint a handle in this owner’s namespace.
Sourcepub fn resolve(
self,
handle: ResidentHandle,
context: &str,
) -> Result<u64, BackendError>
pub fn resolve( self, handle: ResidentHandle, context: &str, ) -> Result<u64, BackendError>
Unwrap a handle minted by this owner, refusing a foreign one.
context names the operation for the error message, for example
"CUDA resident upload".
§Errors
Returns BackendError::InvalidProgram if handle was minted by a
different backend instance. Resolving it by bare id instead would find
this instance’s unrelated buffer of the same id and read or write the
wrong device memory without any diagnostic.
Trait Implementations§
Source§impl Clone for ResidentOwner
impl Clone for ResidentOwner
Source§fn clone(&self) -> ResidentOwner
fn clone(&self) -> ResidentOwner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ResidentOwner
Source§impl Debug for ResidentOwner
impl Debug for ResidentOwner
impl Eq for ResidentOwner
Source§impl Hash for ResidentOwner
impl Hash for ResidentOwner
Source§impl Ord for ResidentOwner
impl Ord for ResidentOwner
Source§fn cmp(&self, other: &ResidentOwner) -> Ordering
fn cmp(&self, other: &ResidentOwner) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ResidentOwner
impl PartialEq for ResidentOwner
Source§impl PartialOrd for ResidentOwner
impl PartialOrd for ResidentOwner
impl StructuralPartialEq for ResidentOwner
Auto Trait Implementations§
impl Freeze for ResidentOwner
impl RefUnwindSafe for ResidentOwner
impl Send for ResidentOwner
impl Sync for ResidentOwner
impl Unpin for ResidentOwner
impl UnsafeUnpin for ResidentOwner
impl UnwindSafe for ResidentOwner
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.