diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-01-31 16:06:44 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-01-31 16:47:00 +0100 |
| commit | 20b1a38414101f842a6d9201133a5aaaa45a7cec (patch) | |
| tree | 2365453d4dfdebfa11d618baad1a36c65b62d7c7 /src/util/mod.rs | |
| parent | fa57d86ed981373b66804972147bf59cab920e6b (diff) | |
Switch from `Rc` to `Arc`
Diffstat (limited to 'src/util/mod.rs')
| -rw-r--r-- | src/util/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
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<T> OptionExt<T> for Option<T> { } /// Additional methods for reference-counted pointers. -pub trait RcExt<T> { +pub trait ArcExt<T> { /// Takes the inner value if there is exactly one strong reference and /// clones it otherwise. fn take(self) -> T; } -impl<T> RcExt<T> for Rc<T> +impl<T> ArcExt<T> for Arc<T> where T: Clone, { fn take(self) -> T { - match Rc::try_unwrap(self) { + match Arc::try_unwrap(self) { Ok(v) => v, Err(rc) => (*rc).clone(), } |
