pub struct ResourceHandle {
pub module: String,
pub type_name: String,
pub id: u64,
pub task_safe: bool,
}Expand description
The identity of one resource a host owns.
ADR 0013: a handle is a name. Every field here is part of the name and
none of them is state — module and type_name say what kind of thing is
named, id says which one, and task_safe is the schema’s answer copied
onto the handle so the task boundary can read it without a registry.
That is why a handle is Arc-shared and immutable: copying one copies a
name, two tasks holding it name the same resource, and a trace that
records it records something a replay can reproduce exactly.
Fields§
§module: StringThe host module that issued this handle, such as database.
type_name: StringThe resource kind, such as Connection.
id: u64Which resource of that kind, unique among the ones this host issued.
task_safe: boolWhether this handle may cross a task boundary, copied from the
resource’s ResourceSchema when the handle was issued.
Implementations§
Source§impl ResourceHandle
impl ResourceHandle
Sourcepub fn new(
module: &str,
resource: &ResourceSchema,
id: u64,
) -> Arc<ResourceHandle>
pub fn new( module: &str, resource: &ResourceSchema, id: u64, ) -> Arc<ResourceHandle>
Issues a handle for resource id of kind resource in module.
Sourcepub fn qualified_type(&self) -> String
pub fn qualified_type(&self) -> String
The type as Cove source writes it: database.Connection.
Sourcepub fn names_same(&self, other: &ResourceHandle) -> bool
pub fn names_same(&self, other: &ResourceHandle) -> bool
Whether two handles name the same resource.
Trait Implementations§
Source§impl Clone for ResourceHandle
impl Clone for ResourceHandle
Source§fn clone(&self) -> ResourceHandle
fn clone(&self) -> ResourceHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResourceHandle
impl Debug for ResourceHandle
Source§impl Display for ResourceHandle
A handle shows as the name it is: the type, and which one.
impl Display for ResourceHandle
A handle shows as the name it is: the type, and which one.
impl Eq for ResourceHandle
Source§impl PartialEq for ResourceHandle
impl PartialEq for ResourceHandle
Source§fn eq(&self, other: &ResourceHandle) -> bool
fn eq(&self, other: &ResourceHandle) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ResourceHandle
Auto Trait Implementations§
impl Freeze for ResourceHandle
impl RefUnwindSafe for ResourceHandle
impl Send for ResourceHandle
impl Sync for ResourceHandle
impl Unpin for ResourceHandle
impl UnsafeUnpin for ResourceHandle
impl UnwindSafe for ResourceHandle
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.