From 20b1a38414101f842a6d9201133a5aaaa45a7cec Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 31 Jan 2022 16:06:44 +0100 Subject: Switch from `Rc` to `Arc` --- src/util/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/util/mod.rs') diff --git a/src/util/mod.rs b/src/util/mod.rs index 61e7131d..de37354e 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -11,7 +11,7 @@ use std::cell::RefMut; use std::cmp::Ordering; use std::ops::Range; use std::path::{Component, Path, PathBuf}; -use std::rc::Rc; +use std::sync::Arc; /// Additional methods for strings. pub trait StrExt { @@ -62,18 +62,18 @@ impl OptionExt for Option { } /// Additional methods for reference-counted pointers. -pub trait RcExt { +pub trait ArcExt { /// Takes the inner value if there is exactly one strong reference and /// clones it otherwise. fn take(self) -> T; } -impl RcExt for Rc +impl ArcExt for Arc where T: Clone, { fn take(self) -> T { - match Rc::try_unwrap(self) { + match Arc::try_unwrap(self) { Ok(v) => v, Err(rc) => (*rc).clone(), } -- cgit v1.2.3