refactor is_borrowed/unborrow into shared/mut variants

This commit is contained in:
Pat Hickey
2020-11-19 15:29:12 -08:00
parent 224e8b0e88
commit f5f180a8fe
5 changed files with 120 additions and 64 deletions

View File

@@ -125,8 +125,11 @@ unsafe impl GuestMemory for HostMemory {
fn has_outstanding_borrows(&self) -> bool {
self.bc.has_outstanding_borrows()
}
fn is_borrowed(&self, r: Region) -> bool {
self.bc.is_borrowed(r)
fn is_shared_borrowed(&self, r: Region) -> bool {
self.bc.is_shared_borrowed(r)
}
fn is_mut_borrowed(&self, r: Region) -> bool {
self.bc.is_mut_borrowed(r)
}
fn mut_borrow(&self, r: Region) -> Result<BorrowHandle, GuestError> {
self.bc.mut_borrow(r)
@@ -134,8 +137,11 @@ unsafe impl GuestMemory for HostMemory {
fn shared_borrow(&self, r: Region) -> Result<BorrowHandle, GuestError> {
self.bc.shared_borrow(r)
}
fn unborrow(&self, h: BorrowHandle) {
self.bc.unborrow(h)
fn shared_unborrow(&self, h: BorrowHandle) {
self.bc.shared_unborrow(h)
}
fn mut_unborrow(&self, h: BorrowHandle) {
self.bc.mut_unborrow(h)
}
}