upgrade dependencies and fix cargo locks

This commit is contained in:
John Smith
2023-08-19 15:16:51 -04:00
parent 73688014e6
commit 89b357350d
8 changed files with 441 additions and 662 deletions

View File

@@ -22,54 +22,54 @@ network-result-extra = []
network-result-info = []
[dependencies]
tracing = { version = "^0", features = ["log", "attributes"], optional = true }
tracing-subscriber = { version = "^0", optional = true }
log = { version = "^0" }
eyre = "^0"
static_assertions = "^1"
cfg-if = "^1"
thiserror = "^1"
futures-util = { version = "^0", default_features = false, features = ["alloc"] }
parking_lot = "^0"
once_cell = "^1"
stop-token = { version = "^0", default-features = false }
rand = "^0.7"
rust-fsm = "^0"
backtrace = "^0"
fn_name = "^0"
range-set-blaze = "0.1.5"
flume = { version = "^0", features = ["async"] }
tracing = { version = "0.1.37", features = ["log", "attributes"], optional = true }
tracing-subscriber = { version = "0.3.17", optional = true }
log = { version = "0.4.20" }
eyre = "0.6.8"
static_assertions = "1.1.0"
cfg-if = "1.0.0"
thiserror = "1.0.47"
futures-util = { version = "0.3.28", default_features = false, features = ["alloc"] }
parking_lot = "0.12.1"
once_cell = "1.18.0"
stop-token = { version = "0.7.0", default-features = false }
rand = "0.8.5"
rand_core = "0.6.4"
backtrace = "0.3.68"
fn_name = "0.1.0"
range-set-blaze = "0.1.9"
flume = { version = "0.11.0", features = ["async"] }
# Dependencies for native builds only
# Linux, Windows, Mac, iOS, Android
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
async-std = { version = "^1", features = ["unstable"], optional = true}
tokio = { version = "^1", features = ["full"], optional = true}
tokio-util = { version = "^0", features = ["compat"], optional = true}
futures-util = { version = "^0", default-features = false, features = ["async-await", "sink", "std", "io"] }
chrono = "^0"
async-std = { version = "1.12.0", features = ["unstable"], optional = true}
tokio = { version = "1.32.0", features = ["full"], optional = true}
tokio-util = { version = "0.7.8", features = ["compat"], optional = true}
futures-util = { version = "0.3.28", default-features = false, features = ["async-await", "sink", "std", "io"] }
chrono = "0.4.26"
libc = "^0"
nix = "^0"
libc = "0.2.147"
nix = "0.26.2"
# Dependencies for WASM builds only
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "^0"
js-sys = "^0"
wasm-bindgen-futures = "^0"
async_executors = { version = "^0", default-features = false}
async-lock = "^2"
send_wrapper = { version = "^0.6", features = ["futures"] }
wasm-bindgen = "0.2.87"
js-sys = "0.3.64"
wasm-bindgen-futures = "0.4.37"
async_executors = { version = "0.7.0", default-features = false}
async-lock = "2.8.0"
send_wrapper = { version = "0.6.0", features = ["futures"] }
# Dependencies for Android
[target.'cfg(target_os = "android")'.dependencies]
jni = "^0"
jni-sys = "^0"
ndk = { version = "^0.7" }
ndk-glue = { version = "^0.7", features = ["logger"] }
lazy_static = "^1.4.0"
paranoid-android = { version = "^0", optional = true }
android-logd-logger = "0.2.1"
jni = "0.21.1"
jni-sys = "0.3.0"
ndk = { version = "0.7.0" }
ndk-glue = { version = "0.7.0", features = ["logger"] }
lazy_static = "1.4.0"
paranoid-android = { version = "0.2.1", optional = true }
android-logd-logger = "0.4.2"
# Dependencies for Windows
# [target.'cfg(target_os = "windows")'.dependencies]
@@ -78,22 +78,21 @@ android-logd-logger = "0.2.1"
# Dependencies for iOS
[target.'cfg(target_os = "ios")'.dependencies]
oslog = { version = "^0", optional = true }
tracing-oslog = { version = "^0", optional = true }
oslog = { version = "0.2.0", optional = true }
tracing-oslog = { version = "0.1.2", optional = true }
### DEV DEPENDENCIES
[dev-dependencies]
serial_test = "^0"
simplelog = { version = "^0.12", features = [ "test" ] }
serial_test = "^2.0.0"
simplelog = { version = "0.12.1", features = [ "test" ] }
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
console_error_panic_hook = "^0"
wasm-bindgen-test = "^0"
wee_alloc = "^0"
wasm-logger = "^0"
tracing-wasm = { version = "^0" }
parking_lot = { version = "^0", features = ["wasm-bindgen"]}
console_error_panic_hook = "0.1.7"
wasm-bindgen-test = "0.3.37"
wee_alloc = "0.4.5"
wasm-logger = "0.2.0"
tracing-wasm = { version = "0.2.1" }
### BUILD OPTIONS

View File

@@ -1,102 +0,0 @@
use super::*;
pub use rust_fsm;
pub use rust_fsm::*;
pub type StateChangeCallback<T> = Arc<
dyn Fn(<T as StateMachineImpl>::State, <T as StateMachineImpl>::State) + Send + Sync + 'static,
>;
struct CallbackStateMachineInner<T>
where
T: StateMachineImpl,
T::State: Copy + Unpin + core::fmt::Debug,
{
state: T::State,
callback: Option<StateChangeCallback<T>>,
eventual: EventualValueClone<T::State>,
}
impl<T> core::fmt::Debug for CallbackStateMachineInner<T>
where
T: StateMachineImpl,
T::State: Copy + Unpin + core::fmt::Debug,
{
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
write!(f, "CallbackStateMachineInner(state: {:?})", self.state)
}
}
#[derive(Debug, Clone)]
pub struct CallbackStateMachine<T>
where
T: StateMachineImpl,
T::State: Copy + Unpin + core::fmt::Debug,
{
inner: Arc<Mutex<CallbackStateMachineInner<T>>>,
}
impl<T> CallbackStateMachine<T>
where
T: StateMachineImpl,
T::State: Copy + Unpin + core::fmt::Debug,
{
pub fn new() -> Self {
Self {
inner: Arc::new(Mutex::new(CallbackStateMachineInner {
state: T::INITIAL_STATE,
callback: None,
eventual: EventualValueClone::new(),
})),
}
}
pub fn set_state_change_callback(&self, callback: StateChangeCallback<T>) {
self.inner.lock().callback = Some(callback);
}
pub fn clear_state_change_callback(&self) {
self.inner.lock().callback = None;
}
pub fn state_eventual_instance(&self) -> (T::State, EventualValueCloneFuture<T::State>) {
let inner = self.inner.lock();
(inner.state, inner.eventual.instance())
}
pub async fn consume(&self, input: &T::Input) -> Result<Option<T::Output>, ()> {
let current_state = self.inner.lock().state;
if let Some(new_state) = T::transition(&current_state, input) {
let output = T::output(&current_state, input);
let old_state = current_state;
let (callback, eventual) = {
let mut inner = self.inner.lock();
inner.state = new_state;
let eventual =
core::mem::replace(&mut inner.eventual, EventualValueClone::<T::State>::new());
(inner.callback.clone(), eventual)
};
if let Some(cb) = callback {
cb(old_state, new_state);
}
eventual.resolve(new_state).await;
Ok(output)
} else {
Err(())
}
}
pub fn state(&self) -> T::State {
self.inner.lock().state
}
}
impl<T> Default for CallbackStateMachine<T>
where
T: StateMachineImpl,
T::State: Copy + Unpin + core::fmt::Debug,
{
fn default() -> Self {
Self::new()
}
}

View File

@@ -2,7 +2,6 @@
mod assembly_buffer;
mod async_peek_stream;
mod async_tag_lock;
mod callback_state_machine;
mod clone_stream;
mod eventual;
mod eventual_base;
@@ -92,7 +91,6 @@ cfg_if! {
pub use assembly_buffer::*;
pub use async_peek_stream::*;
pub use async_tag_lock::*;
pub use callback_state_machine::*;
pub use clone_stream::*;
pub use eventual::*;
pub use eventual_base::{EventualCommon, EventualResolvedFuture};