pub struct ResourceId(/* private fields */);Expand description
Identifies a lockable resource.
A resource is whatever the caller decides to protect with a lock: an entire
database, a table, a page, or a single row. The caller is responsible for
mapping its own object identity to a stable, collision-free u64. Two
distinct resources that map to the same id will share a lock queue, which is
a correctness bug in the caller’s id scheme, not in lock-db.
§Examples
use lock_db::ResourceId;
let page = ResourceId::new(0xDEAD_BEEF);
assert_eq!(page.get(), 0xDEAD_BEEF);Implementations§
Trait Implementations§
Source§impl Clone for ResourceId
impl Clone for ResourceId
Source§fn clone(&self) -> ResourceId
fn clone(&self) -> ResourceId
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ResourceId
Source§impl Debug for ResourceId
impl Debug for ResourceId
Source§impl<'de> Deserialize<'de> for ResourceId
impl<'de> Deserialize<'de> for ResourceId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ResourceId
Source§impl From<ResourceId> for u64
impl From<ResourceId> for u64
Source§fn from(id: ResourceId) -> Self
fn from(id: ResourceId) -> Self
Converts to this type from the input type.
Source§impl From<u64> for ResourceId
impl From<u64> for ResourceId
Source§impl Hash for ResourceId
impl Hash for ResourceId
Source§impl Ord for ResourceId
impl Ord for ResourceId
Source§fn cmp(&self, other: &ResourceId) -> Ordering
fn cmp(&self, other: &ResourceId) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ResourceId
impl PartialEq for ResourceId
Source§fn eq(&self, other: &ResourceId) -> bool
fn eq(&self, other: &ResourceId) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for ResourceId
impl PartialOrd for ResourceId
Source§impl Serialize for ResourceId
impl Serialize for ResourceId
impl StructuralPartialEq for ResourceId
Auto Trait Implementations§
impl Freeze for ResourceId
impl RefUnwindSafe for ResourceId
impl Send for ResourceId
impl Sync for ResourceId
impl Unpin for ResourceId
impl UnsafeUnpin for ResourceId
impl UnwindSafe for ResourceId
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
Mutably borrows from an owned value. Read more