Skip to content

Commit 7649ba0

Browse files
authored
Update Dependencies (#886)
- Updates major runtime dependencies like wasmtime (32.0.0 → 36.0.2) and sysinfo (0.33.1 → 0.37.0) - Adds 'static lifetime bounds to generic type parameters for compatibility with updated dependencies - Replaces git dependency with published version for simdutf8
1 parent 6ce52ec commit 7649ba0

10 files changed

Lines changed: 66 additions & 28 deletions

File tree

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ bytemuck_derive = { version = "1.4.1", default-features = false }
4141
cfg-if = "1.0.0"
4242
itoa = { version = "1.0.3", default-features = false }
4343
time = { version = "0.3.36", default-features = false }
44-
hashbrown = "0.15.2"
44+
hashbrown = "0.16.0"
4545
libm = "0.2.1"
4646
livesplit-hotkey = { path = "crates/livesplit-hotkey", version = "0.8.0", default-features = false }
4747
livesplit-title-abbreviations = { path = "crates/livesplit-title-abbreviations", version = "0.3.0" }
4848
memchr = { version = "2.3.4", default-features = false }
49-
simdutf8 = { git = "https://github.com/CryZe/simdutf8", branch = "wasm-ub-panic", default-features = false, features = [
49+
simdutf8 = { version = "0.1.5", default-features = false, features = [
5050
"aarch64_neon",
5151
] }
5252
serde = { version = "1.0.186", default-features = false, features = ["alloc"] }
@@ -83,7 +83,7 @@ tiny-skia = { version = "0.11.1", default-features = false, features = [
8383
tiny-skia-path = { version = "0.11.1", default-features = false, optional = true }
8484

8585
# SVG Rendering
86-
foldhash = { version = "0.1.3", default-features = false, optional = true }
86+
foldhash = { version = "0.2.0", default-features = false, optional = true }
8787

8888
# Auto Splitting
8989
livesplit-auto-splitting = { path = "crates/livesplit-auto-splitting", version = "0.1.0", optional = true }
@@ -104,7 +104,7 @@ web-sys = { version = "0.3.28", default-features = false, features = [
104104

105105
[target.'cfg(windows)'.dependencies]
106106
# We need windows-sys to use GDI to resolve fonts on Windows.
107-
windows-sys = { version = "0.59.0", features = [
107+
windows-sys = { version = "0.61.0", features = [
108108
"Win32_Foundation",
109109
"Win32_Graphics_Gdi",
110110
], optional = true }
@@ -120,7 +120,7 @@ seahash = "4.1.0"
120120
winreg = "0.55.0"
121121

122122
[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
123-
criterion = "0.5.0"
123+
criterion = "0.7.0"
124124

125125
[features]
126126
default = ["image-shrinking", "std"]

capi/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "livesplit-core-capi"
33
version = "0.11.0"
44
authors = ["Christopher Serr <christopher.serr@gmail.com>"]
55
edition = "2024"
6+
publish = false
67

78
[lib]
89
name = "livesplit_core"
@@ -12,7 +13,7 @@ crate-type = ["staticlib", "cdylib"]
1213
livesplit-core = { path = "..", default-features = false, features = ["std"] }
1314
serde_json = { version = "1.0.8", default-features = false }
1415
time = { version = "0.3.4", default-features = false, features = ["formatting"] }
15-
simdutf8 = { git = "https://github.com/CryZe/simdutf8", branch = "wasm-ub-panic", default-features = false }
16+
simdutf8 = { version = "0.1.5", default-features = false }
1617

1718
wasm-bindgen = { version = "0.2.78", optional = true }
1819
wasm-bindgen-futures = { version = "0.4.28", optional = true }

capi/bind_gen/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ authors = ["Christopher Serr <christopher.serr@gmail.com>"]
33
name = "bindings"
44
version = "0.1.0"
55
edition = "2024"
6+
publish = false
67

78
[dependencies]
89
heck = "0.5.0"

crates/livesplit-auto-splitting/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,24 @@ proc-maps = { version = "0.4.0", default-features = false }
2222
read-process-memory = { version = "0.1.4", default-features = false }
2323
slotmap = { version = "1.0.2", default-features = false }
2424
snafu = "0.8.0"
25-
sysinfo = { version = "0.33.1", default-features = false, features = [
25+
sysinfo = { version = "0.37.0", default-features = false, features = [
2626
"multithread",
2727
"system",
2828
] }
2929
time = { version = "0.3.3", default-features = false }
30-
wasmtime = { version = "32.0.0", default-features = false, features = [
30+
tokio = "1.47.1"
31+
wasmtime = { version = "36.0.2", default-features = false, features = [
3132
"cranelift",
3233
"gc-drc",
3334
"parallel-compilation",
3435
"runtime",
3536
] }
36-
wasmtime-wasi = { version = "32.0.0", default-features = false, features = [
37+
wasmtime-wasi = { version = "36.0.2", default-features = false, features = [
3738
"preview1",
3839
] }
3940

4041
[target.'cfg(windows)'.dependencies]
41-
windows-sys = { version = "0.59.0", features = ["Win32_Storage_FileSystem"] }
42+
windows-sys = { version = "0.61.0", features = ["Win32_Storage_FileSystem"] }
4243

4344
[features]
4445
default = ["enhanced-backtrace"]

crates/livesplit-auto-splitting/src/runtime/api/wasi.rs

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
use std::{
22
collections::VecDeque,
33
path::Path,
4+
pin::Pin,
45
sync::{
56
Arc, Mutex,
67
atomic::{self, AtomicUsize},
78
},
9+
task::{Context, Poll},
810
};
911

1012
use bstr::ByteSlice;
13+
use tokio::io::{self, AsyncWrite};
1114
use wasmtime_wasi::{
12-
DirPerms, FilePerms, OutputStream, Pollable, StdoutStream, StreamError, WasiCtxBuilder,
15+
DirPerms, FilePerms, WasiCtxBuilder,
16+
cli::{IsTerminal, StdoutStream},
17+
p2::{OutputStream, Pollable, StreamError},
1318
preview1::WasiP1Ctx,
1419
};
1520

@@ -28,11 +33,17 @@ struct Buf {
2833
}
2934

3035
impl StdoutStream for StdErr {
31-
fn stream(&self) -> Box<dyn OutputStream> {
36+
fn async_stream(&self) -> Box<dyn AsyncWrite + Send + Sync> {
3237
Box::new(self.clone())
3338
}
3439

35-
fn isatty(&self) -> bool {
40+
fn p2_stream(&self) -> Box<dyn OutputStream> {
41+
Box::new(self.clone())
42+
}
43+
}
44+
45+
impl IsTerminal for StdErr {
46+
fn is_terminal(&self) -> bool {
3647
false
3748
}
3849
}
@@ -61,10 +72,8 @@ impl StdErr {
6172
timer.log_auto_splitter(format_args!("{}", to_print.trim().as_bstr()));
6273
buf.drain(..flush_idx);
6374
}
64-
}
6575

66-
impl OutputStream for StdErr {
67-
fn write(&mut self, bytes: bytes::Bytes) -> Result<(), StreamError> {
76+
fn write(&mut self, bytes: &[u8]) -> Result<(), StreamError> {
6877
let buffer = &mut *self.buffer.buf.lock().unwrap();
6978
if bytes.len() > ERR_CAPACITY - buffer.len() {
7079
return Err(StreamError::Trap(anyhow::format_err!(
@@ -77,9 +86,15 @@ impl OutputStream for StdErr {
7786
atomic::Ordering::Relaxed,
7887
);
7988

80-
buffer.extend(bytes.as_ref());
89+
buffer.extend(bytes);
8190
Ok(())
8291
}
92+
}
93+
94+
impl OutputStream for StdErr {
95+
fn write(&mut self, bytes: bytes::Bytes) -> Result<(), StreamError> {
96+
self.write(&bytes)
97+
}
8398

8499
fn flush(&mut self) -> Result<(), StreamError> {
85100
let len = self.buffer.buf.lock().unwrap().len();
@@ -93,6 +108,25 @@ impl OutputStream for StdErr {
93108
}
94109
}
95110

111+
impl AsyncWrite for StdErr {
112+
fn poll_write(
113+
mut self: Pin<&mut Self>,
114+
_cx: &mut Context,
115+
buf: &[u8],
116+
) -> Poll<io::Result<usize>> {
117+
match self.as_mut().write(buf) {
118+
Ok(()) => Poll::Ready(Ok(buf.len())),
119+
Err(e) => Poll::Ready(Err(io::Error::other(e))),
120+
}
121+
}
122+
fn poll_flush(mut self: Pin<&mut Self>, _cx: &mut Context) -> Poll<io::Result<()>> {
123+
Poll::Ready(self.as_mut().flush().map_err(io::Error::other))
124+
}
125+
fn poll_shutdown(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<io::Result<()>> {
126+
Poll::Ready(Ok(()))
127+
}
128+
}
129+
96130
#[async_trait::async_trait]
97131
impl Pollable for StdErr {
98132
async fn ready(&mut self) {}

crates/livesplit-auto-splitting/src/runtime/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use snafu::Snafu;
1515
use std::{
1616
path::Path,
1717
sync::{
18-
atomic::{self, AtomicU64},
1918
Arc, Mutex, MutexGuard,
19+
atomic::{self, AtomicU64},
2020
},
2121
time::{Duration, Instant},
2222
};
@@ -218,7 +218,7 @@ struct SharedData {
218218
tick_rate: AtomicU64,
219219
}
220220

221-
struct ExclusiveData<T> {
221+
struct ExclusiveData<T: 'static> {
222222
trapped: bool,
223223
store: Store<Context<T>>,
224224
update: TypedFunc<(), ()>,
@@ -232,7 +232,7 @@ struct ExclusiveData<T> {
232232
/// available on the auto splitter are generally thread-safe and don't block.
233233
/// This allows other threads to access and modify information such as settings
234234
/// without needing to worry that those threads get blocked.
235-
pub struct AutoSplitter<T> {
235+
pub struct AutoSplitter<T: 'static> {
236236
exclusive_data: Mutex<ExclusiveData<T>>,
237237
engine: Engine,
238238
settings_widgets: ArcSwap<Vec<settings::Widget>>,

crates/livesplit-auto-splitting/src/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub enum LogLevel {
3232
}
3333

3434
/// A timer that can be controlled by an auto splitter.
35-
pub trait Timer: Send {
35+
pub trait Timer: Send + 'static {
3636
/// Returns the current state of the timer.
3737
fn state(&self) -> TimerState;
3838
/// Accesses the index of the split the attempt is currently on.

crates/livesplit-hotkey/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ edition = "2024"
1111
rust-version = "1.89"
1212

1313
[target.'cfg(windows)'.dependencies]
14-
windows-sys = { version = "0.59.0", features = [
14+
windows-sys = { version = "0.61.0", features = [
1515
"Win32_Foundation",
1616
"Win32_System_LibraryLoader",
1717
"Win32_System_Threading",
@@ -21,12 +21,12 @@ windows-sys = { version = "0.59.0", features = [
2121

2222
[target.'cfg(target_os = "linux")'.dependencies]
2323
crossbeam-channel = { version = "0.5.6", optional = true }
24-
evdev = { version = "0.12.1", optional = true }
24+
evdev = { version = "0.13.1", optional = true }
2525
mio = { version = "1.0.2", default-features = false, features = [
2626
"os-ext",
2727
"os-poll",
2828
], optional = true }
29-
nix = { version = "0.29.0", features = ["user"], optional = true }
29+
nix = { version = "0.30.1", features = ["user"], optional = true }
3030
promising-future = { version = "0.2.4", optional = true }
3131
x11-dl = { version = "2.20.0", optional = true }
3232

crates/livesplit-hotkey/src/linux/evdev_impl.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{collections::hash_map::HashMap, os::unix::prelude::AsRawFd, ptr, thread};
22

3-
use evdev::{Device, EventType, InputEventKind, Key};
3+
use evdev::{Device, EventType, KeyCode as Key};
44
use mio::{Events, Interest, Poll, Token, Waker, unix::SourceFd};
55
use x11_dl::xlib::{_XDisplay, Xlib};
66

@@ -269,7 +269,8 @@ pub fn new() -> Result<Hook> {
269269
if mio_event.token().0 < devices.len() {
270270
let idx = mio_event.token().0;
271271
for ev in devices[idx].fetch_events().map_err(|_| Error::EvDev)? {
272-
if let InputEventKind::Key(k) = ev.kind() {
272+
if ev.event_type() == EventType::KEY {
273+
let k = Key::new(ev.code());
273274
const RELEASED: i32 = 0;
274275
const PRESSED: i32 = 1;
275276
match ev.value() {

src/auto_splitting/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ pub struct Runtime<T: event::CommandSink + TimerQuery + Send + 'static> {
616616
runtime: livesplit_auto_splitting::Runtime,
617617
}
618618

619-
struct SharedState<T> {
619+
struct SharedState<T: 'static> {
620620
auto_splitter: ArcSwapOption<AutoSplitter<Timer<T>>>,
621621
watchdog_state: Mutex<WatchdogState>,
622622
watchdog_state_update: Condvar,
@@ -789,7 +789,7 @@ impl<T: event::CommandSink + TimerQuery + Send + 'static> Runtime<T> {
789789
// is an Arc<RwLock<T>>, so we can't implement the trait directly on it.
790790
struct Timer<E>(E);
791791

792-
impl<E: event::CommandSink + TimerQuery + Send> AutoSplitTimer for Timer<E> {
792+
impl<E: event::CommandSink + TimerQuery + Send + 'static> AutoSplitTimer for Timer<E> {
793793
fn state(&self) -> TimerState {
794794
match self.0.get_timer().current_phase() {
795795
TimerPhase::NotRunning => TimerState::NotRunning,

0 commit comments

Comments
 (0)