feat: implement shallow clone for PExpected

This commit is contained in:
rvcas 2021-06-15 19:20:15 -04:00
parent 05181e4be0
commit 22dc0fe6c7

View File

@ -12,6 +12,7 @@
/// This is important for performance.
use libc::{c_void, MAP_ANONYMOUS, MAP_PRIVATE, PROT_READ, PROT_WRITE};
use roc_can::expected::Expected;
use roc_can::expected::PExpected;
use std::cmp::Ordering;
use std::marker::PhantomData;
use std::mem::size_of;
@ -620,3 +621,14 @@ impl<T: ShallowClone> ShallowClone for Expected<T> {
}
}
}
impl<T: ShallowClone> ShallowClone for PExpected<T> {
fn shallow_clone(&self) -> Self {
use PExpected::*;
match self {
NoExpectation(t) => NoExpectation(t.shallow_clone()),
ForReason(reason, t, region) => ForReason(reason.clone(), t.shallow_clone(), *region),
}
}
}