From 89f39b8ad4cb98c078a0106441ffacaf41cfbff3 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 15 Nov 2024 19:55:57 +0000 Subject: [PATCH] fix: impl Clone for Net --- src/net/system.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/net/system.rs b/src/net/system.rs index 3b4b775..7c59a05 100644 --- a/src/net/system.rs +++ b/src/net/system.rs @@ -1,5 +1,5 @@ // -use std::cell::RefCell; +use std::{cell::RefCell, rc::Rc}; use reqwest::{Body, Client}; @@ -57,8 +57,9 @@ impl Plan { } /// An abstraction for the network +#[derive(Clone)] pub struct Net { - plans: Option>, + plans: Option>>, } impl Net { /// Creates a new unmocked [Net] for creating real network requests. @@ -238,7 +239,7 @@ impl From for Net { Self { // 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 - plans: Some(RefCell::new(mock_net.plans.take())), + plans: Some(Rc::new(RefCell::new(mock_net.plans.take()))), } } }