mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
refactor: switch to Rust 2024 edition (#2645)
This commit is contained in:
parent
0b90a7268a
commit
6bd7a8039a
28 changed files with 54 additions and 57 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
|
@ -367,9 +367,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.36"
|
version = "4.5.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2df961d8c8a0d08aa9945718ccf584145eee3f3aa06cddbeac12933781102e04"
|
checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
|
|
@ -377,9 +377,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.36"
|
version = "4.5.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "132dbda40fb6753878316a489d5a1242a8ef2f0d9e47ba01c951ea8aa7d013a5"
|
checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
|
@ -2270,9 +2270,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "signal-hook-registry"
|
name = "signal-hook-registry"
|
||||||
version = "1.4.2"
|
version = "1.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
|
checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ ansi-to-tui = "7.0.0"
|
||||||
anyhow = "1.0.98"
|
anyhow = "1.0.98"
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
bitflags = "2.9.0"
|
bitflags = "2.9.0"
|
||||||
clap = { version = "4.5.36", features = [ "derive" ] }
|
clap = { version = "4.5.37", features = [ "derive" ] }
|
||||||
core-foundation-sys = "0.8.7"
|
core-foundation-sys = "0.8.7"
|
||||||
crossterm = { version = "0.29.0", features = [ "event-stream" ] }
|
crossterm = { version = "0.29.0", features = [ "event-stream" ] }
|
||||||
dirs = "6.0.0"
|
dirs = "6.0.0"
|
||||||
|
|
|
||||||
12
flake.lock
generated
12
flake.lock
generated
|
|
@ -20,11 +20,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737003892,
|
"lastModified": 1744868846,
|
||||||
"narHash": "sha256-RCzJE9wKByLCXmRBp+z8LK9EgdW+K+W/DXnJS4S/NVo=",
|
"narHash": "sha256-5RJTdUHDmj12Qsv7XOhuospjAjATNiTMElplWnJE9Hs=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ae06b9c2d83cb5c8b12d7d0e32692e93d1379713",
|
"rev": "ebe4301cbd8f81c4f8d3244b3632338bbeb6d49c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -48,11 +48,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737080704,
|
"lastModified": 1745116541,
|
||||||
"narHash": "sha256-n+J2h9GM9ZpFOQUmtZoCr1+DFF/iO5UlmLJeHIxbZGY=",
|
"narHash": "sha256-5xzA6dTfqCfTTDCo3ipPZzrg3wp01xmcr73y4cTNMP8=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "f9953fe89f8b65401fc4d4a288940bc2cb072949",
|
"rev": "e2142ef330a61c02f274ac9a9cb6f8487a5d0080",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-adapter"
|
name = "yazi-adapter"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi image adapter"
|
description = "Yazi image adapter"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-binding"
|
name = "yazi-binding"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi Lua bindings"
|
description = "Yazi Lua bindings"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-boot"
|
name = "yazi-boot"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi bootstrapper"
|
description = "Yazi bootstrapper"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-cli"
|
name = "yazi-cli"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi command-line interface"
|
description = "Yazi command-line interface"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-codegen"
|
name = "yazi-codegen"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi codegen"
|
description = "Yazi codegen"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-config"
|
name = "yazi-config"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi configuration file parser"
|
description = "Yazi configuration file parser"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-core"
|
name = "yazi-core"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi core logic"
|
description = "Yazi core logic"
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ impl Mgr {
|
||||||
let mut sorted = Vec::with_capacity(old.len());
|
let mut sorted = Vec::with_capacity(old.len());
|
||||||
while !todos.is_empty() {
|
while !todos.is_empty() {
|
||||||
// Paths that are non-incomes and don't need to be prioritized in this round
|
// Paths that are non-incomes and don't need to be prioritized in this round
|
||||||
let mut outcomes: Vec<_> = incomes.iter().filter(|(_, &b)| !b).map(|(&p, _)| p).collect();
|
let mut outcomes: Vec<_> = incomes.iter().filter(|&(_, b)| !b).map(|(&p, _)| p).collect();
|
||||||
outcomes.sort_unstable_by(|a, b| orders[b].cmp(&orders[a]));
|
outcomes.sort_unstable_by(|a, b| orders[b].cmp(&orders[a]));
|
||||||
|
|
||||||
// If there're no outcomes, it means there are cycles in the renaming
|
// If there're no outcomes, it means there are cycles in the renaming
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@ impl Tab {
|
||||||
handle.abort();
|
handle.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut input =
|
let mut input = InputProxy::show(InputCfg::search(opt.via.as_ref()).with_value(&*opt.subject));
|
||||||
InputProxy::show(InputCfg::search(opt.via.as_ref()).with_value(opt.subject.to_owned()));
|
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
if let Some(Ok(subject)) = input.recv().await {
|
if let Some(Ok(subject)) = input.recv().await {
|
||||||
opt.subject = Cow::Owned(subject);
|
opt.subject = Cow::Owned(subject);
|
||||||
|
|
|
||||||
|
|
@ -56,9 +56,7 @@ impl Tab {
|
||||||
let selected = self.hovered_and_selected().cloned().collect();
|
let selected = self.hovered_and_selected().cloned().collect();
|
||||||
|
|
||||||
let input = opt.interactive.then(|| {
|
let input = opt.interactive.then(|| {
|
||||||
InputProxy::show(
|
InputProxy::show(InputCfg::shell(opt.block).with_value(&*opt.run).with_cursor(opt.cursor))
|
||||||
InputCfg::shell(opt.block).with_value(opt.run.to_owned()).with_cursor(opt.cursor),
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-dds"
|
name = "yazi-dds"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi data distribution service"
|
description = "Yazi data distribution service"
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,16 @@ pub fn init() {
|
||||||
REMOTE.with(<_>::default);
|
REMOTE.with(<_>::default);
|
||||||
|
|
||||||
// Env
|
// Env
|
||||||
if let Some(s) = std::env::var("YAZI_ID").ok().filter(|s| !s.is_empty()) {
|
unsafe {
|
||||||
std::env::set_var("YAZI_PID", s);
|
if let Some(s) = std::env::var("YAZI_ID").ok().filter(|s| !s.is_empty()) {
|
||||||
|
std::env::set_var("YAZI_PID", s);
|
||||||
|
}
|
||||||
|
std::env::set_var("YAZI_ID", ID.to_string());
|
||||||
|
std::env::set_var(
|
||||||
|
"YAZI_LEVEL",
|
||||||
|
(std::env::var("YAZI_LEVEL").unwrap_or_default().parse().unwrap_or(0u16) + 1).to_string(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
std::env::set_var("YAZI_ID", ID.to_string());
|
|
||||||
std::env::set_var(
|
|
||||||
"YAZI_LEVEL",
|
|
||||||
(std::env::var("YAZI_LEVEL").unwrap_or_default().parse().unwrap_or(0u16) + 1).to_string(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn serve() {
|
pub fn serve() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-ffi"
|
name = "yazi-ffi"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi foreign function interface"
|
description = "Yazi foreign function interface"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::ffi::{c_char, c_void};
|
||||||
use core_foundation_sys::{array::CFArrayRef, base::CFAllocatorRef, dictionary::CFDictionaryRef, runloop::CFRunLoopRef, string::CFStringRef};
|
use core_foundation_sys::{array::CFArrayRef, base::CFAllocatorRef, dictionary::CFDictionaryRef, runloop::CFRunLoopRef, string::CFStringRef};
|
||||||
|
|
||||||
#[link(name = "DiskArbitration", kind = "framework")]
|
#[link(name = "DiskArbitration", kind = "framework")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
pub fn DASessionCreate(allocator: CFAllocatorRef) -> *const c_void;
|
pub fn DASessionCreate(allocator: CFAllocatorRef) -> *const c_void;
|
||||||
|
|
||||||
pub fn DADiskCreateFromBSDName(
|
pub fn DADiskCreateFromBSDName(
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use core_foundation_sys::{base::{CFAllocatorRef, CFTypeRef, mach_port_t}, dictio
|
||||||
use libc::kern_return_t;
|
use libc::kern_return_t;
|
||||||
|
|
||||||
#[link(name = "IOKit", kind = "framework")]
|
#[link(name = "IOKit", kind = "framework")]
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
pub fn IOServiceGetMatchingServices(
|
pub fn IOServiceGetMatchingServices(
|
||||||
mainPort: mach_port_t,
|
mainPort: mach_port_t,
|
||||||
matching: CFMutableDictionaryRef,
|
matching: CFMutableDictionaryRef,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-fm"
|
name = "yazi-fm"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi File Manager"
|
description = "Yazi File Manager"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-fs"
|
name = "yazi-fs"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi file system"
|
description = "Yazi file system"
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ impl Cwd {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.store(Arc::new(url.clone()));
|
self.store(Arc::new(url.clone()));
|
||||||
std::env::set_var("PWD", url);
|
unsafe { std::env::set_var("PWD", url) };
|
||||||
|
|
||||||
Self::sync_cwd();
|
Self::sync_cwd();
|
||||||
true
|
true
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-macro"
|
name = "yazi-macro"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi macros"
|
description = "Yazi macros"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-plugin"
|
name = "yazi-plugin"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi plugin system"
|
description = "Yazi plugin system"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-proxy"
|
name = "yazi-proxy"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi event proxy"
|
description = "Yazi event proxy"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-scheduler"
|
name = "yazi-scheduler"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi task scheduler"
|
description = "Yazi task scheduler"
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-shared"
|
name = "yazi-shared"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi shared library"
|
description = "Yazi shared library"
|
||||||
homepage = "https://yazi-rs.github.io"
|
homepage = "https://yazi-rs.github.io"
|
||||||
repository = "https://github.com/sxyazi/yazi"
|
repository = "https://github.com/sxyazi/yazi"
|
||||||
rust-version = "1.83.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
yazi-macro = { path = "../yazi-macro", version = "25.4.8" }
|
yazi-macro = { path = "../yazi-macro", version = "25.4.8" }
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ fn split_slice(s: &[u16]) -> std::io::Result<Vec<String>> {
|
||||||
|
|
||||||
use windows_sys::{Win32::{Foundation::LocalFree, UI::Shell::CommandLineToArgvW}, core::PCWSTR};
|
use windows_sys::{Win32::{Foundation::LocalFree, UI::Shell::CommandLineToArgvW}, core::PCWSTR};
|
||||||
|
|
||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn wcslen(s: PCWSTR) -> usize;
|
fn wcslen(s: PCWSTR) -> usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
name = "yazi-widgets"
|
name = "yazi-widgets"
|
||||||
version = "25.4.8"
|
version = "25.4.8"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
authors = [ "sxyazi <sxyazi@gmail.com>" ]
|
||||||
description = "Yazi user interface widgets"
|
description = "Yazi user interface widgets"
|
||||||
homepage = "https://yazi-rs.github.io"
|
homepage = "https://yazi-rs.github.io"
|
||||||
repository = "https://github.com/sxyazi/yazi"
|
repository = "https://github.com/sxyazi/yazi"
|
||||||
rust-version = "1.83.0"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
yazi-codegen = { path = "../yazi-codegen", version = "25.4.8" }
|
yazi-codegen = { path = "../yazi-codegen", version = "25.4.8" }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue