fix: impl Clone for Net
This commit is contained in:
parent
7e1b3de984
commit
89f39b8ad4
1 changed files with 4 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
use std::cell::RefCell;
|
use std::{cell::RefCell, rc::Rc};
|
||||||
|
|
||||||
use reqwest::{Body, Client};
|
use reqwest::{Body, Client};
|
||||||
|
|
||||||
|
@ -57,8 +57,9 @@ impl Plan {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An abstraction for the network
|
/// An abstraction for the network
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Net {
|
pub struct Net {
|
||||||
plans: Option<RefCell<Plans>>,
|
plans: Option<Rc<RefCell<Plans>>>,
|
||||||
}
|
}
|
||||||
impl Net {
|
impl Net {
|
||||||
/// Creates a new unmocked [Net] for creating real network requests.
|
/// Creates a new unmocked [Net] for creating real network requests.
|
||||||
|
@ -238,7 +239,7 @@ impl From<MockNet> for Net {
|
||||||
Self {
|
Self {
|
||||||
// keep the original `inner` around to allow it's Drop impelmentation to run when we go
|
// keep the original `inner` around to allow it's Drop impelmentation to run when we go
|
||||||
// out of scope at the end of the test
|
// out of scope at the end of the test
|
||||||
plans: Some(RefCell::new(mock_net.plans.take())),
|
plans: Some(Rc::new(RefCell::new(mock_net.plans.take()))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue