Skip to content

Commit

Permalink
Replace bevy_utils::CowArc with atomicow (#14977)
Browse files Browse the repository at this point in the history
# Objective

- Fixes #14975

## Solution

- Replace usages of `bevy_utils::CowArc` with `atomicow::CowArc`
- Remove bevy_utils::CowArc

## Testing

- `bevy_asset` test suite continues to pass.

---

## Migration Guide

`bevy_utils::CowArc` has moved to a new crate called
[atomicow](https://crates.io/crates/atomicow).
  • Loading branch information
chrisjuchem authored Aug 30, 2024
1 parent 9e78433 commit e08497d
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 199 deletions.
1 change: 1 addition & 0 deletions crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.15.0-dev" }
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }

stackfuture = "0.3"
atomicow = "1.0"
async-broadcast = "0.5"
async-fs = "2.0"
async-lock = "3.0"
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/io/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use crate::{
io::{processor_gated::ProcessorGatedReader, AssetSourceEvent, AssetWatcher},
processor::AssetProcessorData,
};
use atomicow::CowArc;
use bevy_ecs::system::Resource;
use bevy_utils::tracing::{error, warn};
use bevy_utils::{CowArc, Duration, HashMap};
use bevy_utils::{Duration, HashMap};
use std::{fmt::Display, hash::Hash, sync::Arc};
use thiserror::Error;

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ use crate::{
Asset, AssetLoadError, AssetServer, AssetServerMode, Assets, Handle, UntypedAssetId,
UntypedHandle,
};
use atomicow::CowArc;
use bevy_ecs::world::World;
use bevy_utils::{BoxedFuture, ConditionalSendFuture, CowArc, HashMap, HashSet};
use bevy_utils::{BoxedFuture, ConditionalSendFuture, HashMap, HashSet};
use downcast_rs::{impl_downcast, Downcast};
use ron::error::SpannedError;
use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_asset/src/path.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::io::AssetSourceId;
use atomicow::CowArc;
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
use bevy_utils::CowArc;
use serde::{de::Visitor, Deserialize, Serialize};
use std::{
fmt::{Debug, Display},
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/saver.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::transformer::TransformedAsset;
use crate::{io::Writer, meta::Settings, Asset, ErasedLoadedAsset};
use crate::{AssetLoader, Handle, LabeledAsset, UntypedHandle};
use bevy_utils::{BoxedFuture, ConditionalSendFuture, CowArc, HashMap};
use atomicow::CowArc;
use bevy_utils::{BoxedFuture, ConditionalSendFuture, HashMap};
use serde::{Deserialize, Serialize};
use std::{borrow::Borrow, hash::Hash, ops::Deref};

Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ use crate::{
DeserializeMetaError, ErasedLoadedAsset, Handle, LoadedUntypedAsset, UntypedAssetId,
UntypedAssetLoadFailedEvent, UntypedHandle,
};
use atomicow::CowArc;
use bevy_ecs::prelude::*;
use bevy_tasks::IoTaskPool;
use bevy_utils::tracing::{error, info};
use bevy_utils::{CowArc, HashSet};
use bevy_utils::HashSet;
use crossbeam_channel::{Receiver, Sender};
use futures_lite::{FutureExt, StreamExt};
use info::*;
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_asset/src/transformer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{meta::Settings, Asset, ErasedLoadedAsset, Handle, LabeledAsset, UntypedHandle};
use bevy_utils::{ConditionalSendFuture, CowArc, HashMap};
use atomicow::CowArc;
use bevy_utils::{ConditionalSendFuture, HashMap};
use serde::{Deserialize, Serialize};
use std::{
borrow::Borrow,
Expand Down
191 changes: 0 additions & 191 deletions crates/bevy_utils/src/cow_arc.rs

This file was deleted.

2 changes: 0 additions & 2 deletions crates/bevy_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub use short_names::get_short_name;
pub mod synccell;
pub mod syncunsafecell;

mod cow_arc;
mod default;
mod object_safe;
pub use object_safe::assert_object_safe;
Expand All @@ -30,7 +29,6 @@ mod parallel_queue;

pub use ahash::{AHasher, RandomState};
pub use bevy_utils_proc_macros::*;
pub use cow_arc::*;
pub use default::default;
pub use hashbrown;
pub use parallel_queue::*;
Expand Down

0 comments on commit e08497d

Please sign in to comment.