Lines Matching refs:owner
79 owner: *const U,
97 /// It stores a raw pointer to the owner that is never dereferenced. It is only used to ensure
98 /// that the right owner is being used to access the protected data. If the owner is freed, the
99 /// data becomes inaccessible; if another instance of the owner is allocated *on the same
102 pub fn new<B: Backend>(owner: &Lock<U, B>, data: T) -> Self {
108 owner: owner.data.get(),
116 /// reference) that the owner is locked.
123 /// Panics if `owner` is different from the data protected by the lock used in
125 pub fn access<'a>(&'a self, owner: &'a U) -> &'a T
131 "`U` cannot be a ZST because `owner` wouldn't be unique"
133 if !ptr::eq(owner, self.owner) {
137 // SAFETY: `owner` is evidence that there are only shared references to the owner for the
145 /// mutable owner) that the owner is locked mutably.
150 /// Showing a mutable reference to the owner is sufficient because we know no other references
155 /// Panics if `owner` is different from the data protected by the lock used in
157 pub fn access_mut<'a>(&'a self, owner: &'a mut U) -> &'a mut T {
160 "`U` cannot be a ZST because `owner` wouldn't be unique"
162 if !ptr::eq(owner, self.owner) {
166 // SAFETY: `owner` is evidence that there is only one reference to the owner.