Switch to Rc to fix the multiple references issue.
This commit is contained in:
parent
ce4b4a27f9
commit
ec2d09b72a
@ -11,7 +11,7 @@ pub struct TestContext<T> {
|
|||||||
head: ContextReference<T>,
|
head: ContextReference<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContextReference<T> = Option<Box<ContextLayer<T>>>;
|
type ContextReference<T> = Option<Rc<ContextLayer<T>>>;
|
||||||
|
|
||||||
struct ContextLayer<T> {
|
struct ContextLayer<T> {
|
||||||
data: T,
|
data: T,
|
||||||
@ -32,11 +32,11 @@ impl TestContext<ContextData> {
|
|||||||
new_matcher: MatcherRef,
|
new_matcher: MatcherRef,
|
||||||
) -> TestContext<ContextData> {
|
) -> TestContext<ContextData> {
|
||||||
TestContext {
|
TestContext {
|
||||||
head: Some(Box::new(ContextLayer {
|
head: Some(Rc::new(ContextLayer {
|
||||||
data: ContextData {
|
data: ContextData {
|
||||||
fail_matcher: ChainBehavior::AndParent(Some(new_matcher)),
|
fail_matcher: ChainBehavior::AndParent(Some(new_matcher)),
|
||||||
},
|
},
|
||||||
parent: self.head, // TODO FIX THIS
|
parent: self.head.clone(),
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user