fix: impl Clone for Net
All checks were successful
Rust / build (map[name:nightly]) (push) Successful in 4m33s
Rust / build (map[name:stable]) (push) Successful in 8m57s
Release Please / Release-plz (push) Successful in 45s

This commit is contained in:
Paul Campbell 2024-11-15 19:55:57 +00:00
parent 7e1b3de984
commit 89f39b8ad4

View file

@ -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()))),
} }
} }
} }