Fix cloned rsx double drop (#2839)
* Implement Rc generational pointers * Clean up error handling a bit * start adding tests * Simplify a few types * Separate Rc and normal generational boxes * Add tests for rc drop and read * Move over the pointer instead of the data in ReadOnlySignal props * Fix panic on ref drop and release mode builds * final rc signal cleanup * use rc generational boxes for event handlers as well * add a regression test for read only signal cloning * merge main --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
20d146d9bd
commit
baf5a95cae
19 files changed
+905
-250
No files matched your search
@@ -5,7 +5,10 @@ use std::fmt::Display;
|
||||
use crate::GenerationalLocation;
|
||||
|
||||
/// A result that can be returned from a borrow operation.
|
||||
pub type BorrowResult<T> = std::result::Result<T, BorrowError>;
|
||||
pub type BorrowResult<T = ()> = std::result::Result<T, BorrowError>;
|
||||
|
||||
/// A result that can be returned from a borrow mut operation.
|
||||
pub type BorrowMutResult<T = ()> = std::result::Result<T, BorrowMutError>;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
/// An error that can occur when trying to borrow a value.
|
||||
@@ -50,6 +53,15 @@ impl Display for BorrowMutError {
|
||||
|
||||
impl Error for BorrowMutError {}
|
||||
|
||||
impl From<BorrowError> for BorrowMutError {
|
||||
fn from(error: BorrowError) -> Self {
|
||||
match error {
|
||||
BorrowError::Dropped(error) => BorrowMutError::Dropped(error),
|
||||
BorrowError::AlreadyBorrowedMut(error) => BorrowMutError::AlreadyBorrowedMut(error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An error that can occur when trying to use a value that has been dropped.
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
pub struct ValueDroppedError {
|
||||
|
||||
Reference in new issue
Block a user