diff --git a/Cargo.lock b/Cargo.lock index 1854190fb..6796f3f7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8036,7 +8036,6 @@ dependencies = [ "half", "image", "ndarray", - "once_cell", "ort", "prisma-client-rust", "reqwest 0.11.27", @@ -8103,7 +8102,6 @@ dependencies = [ "mini-moka", "normpath", "notify", - "once_cell", "openssl", "openssl-sys", "pin-project-lite", @@ -8192,7 +8190,6 @@ dependencies = [ "image", "itertools 0.13.0", "lending-stream", - "once_cell", "prisma-client-rust", "rmp-serde", "rmpv", @@ -8232,7 +8229,6 @@ dependencies = [ "futures-concurrency", "gix-ignore", "globset", - "once_cell", "prisma-client-rust", "rmp-serde", "rspc", @@ -8417,7 +8413,6 @@ dependencies = [ "image", "libheif-rs", "libheif-sys", - "once_cell", "pdfium-render", "resvg", "rspc", @@ -8459,7 +8454,6 @@ dependencies = [ "futures", "futures-channel", "futures-locks", - "once_cell", "rspc", "sd-core", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index c8a312cc0..cdcd937bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ resolver = "2" edition = "2021" license = "AGPL-3.0-only" repository = "https://github.com/spacedriveapp/spacedrive" -rust-version = "1.80" +rust-version = "1.81" [workspace.dependencies] # Third party dependencies used by one or more of our crates @@ -39,7 +39,6 @@ lending-stream = "1.0" libc = "0.2" mimalloc = "0.1.43" normpath = "1.2" -once_cell = "1.19" pin-project-lite = "0.2.14" rand = "0.9.0-alpha.2" regex = "1.10" diff --git a/apps/mobile/modules/sd-core/android/crate/Cargo.toml b/apps/mobile/modules/sd-core/android/crate/Cargo.toml index c33ebc6e6..deec48631 100644 --- a/apps/mobile/modules/sd-core/android/crate/Cargo.toml +++ b/apps/mobile/modules/sd-core/android/crate/Cargo.toml @@ -2,10 +2,10 @@ name = "sd-mobile-android" version = "0.1.0" -edition.workspace = true -license.workspace = true -repository.workspace = true -rust-version = "1.64" +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true [lib] # Android can use dynamic linking since all FFI is done via JNI diff --git a/apps/mobile/modules/sd-core/core/Cargo.toml b/apps/mobile/modules/sd-core/core/Cargo.toml index 7165278de..75d627d32 100644 --- a/apps/mobile/modules/sd-core/core/Cargo.toml +++ b/apps/mobile/modules/sd-core/core/Cargo.toml @@ -2,10 +2,10 @@ name = "sd-mobile-core" version = "0.1.0" -edition.workspace = true -license.workspace = true -repository.workspace = true -rust-version = "1.64" +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true [target.'cfg(target_os = "android")'.dependencies] sd-core = { default-features = false, features = ["mobile"], path = "../../../../../core" } @@ -19,7 +19,6 @@ sd-core = { default-features = false, features = [ # Workspace dependencies futures = { workspace = true } -once_cell = { workspace = true } rspc = { workspace = true } serde_json = { workspace = true } tokio = { workspace = true } diff --git a/apps/mobile/modules/sd-core/core/src/lib.rs b/apps/mobile/modules/sd-core/core/src/lib.rs index e5cc08988..49048ce6d 100644 --- a/apps/mobile/modules/sd-core/core/src/lib.rs +++ b/apps/mobile/modules/sd-core/core/src/lib.rs @@ -2,7 +2,6 @@ use futures::{future::join_all, StreamExt}; use futures_channel::mpsc; -use once_cell::sync::{Lazy, OnceCell}; use rspc::internal::jsonrpc::{ self, handle_json_rpc, OwnedMpscSender, Request, RequestId, Response, Sender, SubscriptionUpgrade, @@ -14,7 +13,7 @@ use std::{ collections::HashMap, future::{ready, Ready}, marker::Send, - sync::Arc, + sync::{Arc, LazyLock, OnceLock}, }; use tokio::{ runtime::Runtime, @@ -22,17 +21,18 @@ use tokio::{ }; use tracing::error; -pub static RUNTIME: Lazy = Lazy::new(|| Runtime::new().unwrap()); +pub static RUNTIME: LazyLock = LazyLock::new(|| Runtime::new().unwrap()); -pub type NodeType = Lazy, Arc)>>>; +pub type NodeType = LazyLock, Arc)>>>; -pub static NODE: NodeType = Lazy::new(|| Mutex::new(None)); +pub static NODE: NodeType = LazyLock::new(|| Mutex::new(None)); #[allow(clippy::type_complexity)] -pub static SUBSCRIPTIONS: Lazy>>>> = - Lazy::new(Default::default); +pub static SUBSCRIPTIONS: LazyLock< + Arc>>>, +> = LazyLock::new(Default::default); -pub static EVENT_SENDER: OnceCell> = OnceCell::new(); +pub static EVENT_SENDER: OnceLock> = OnceLock::new(); pub const CLIENT_ID: &str = "d068776a-05b6-4aaa-9001-4d01734e1944"; diff --git a/apps/mobile/modules/sd-core/ios/crate/Cargo.toml b/apps/mobile/modules/sd-core/ios/crate/Cargo.toml index 60f59f295..0503e293d 100644 --- a/apps/mobile/modules/sd-core/ios/crate/Cargo.toml +++ b/apps/mobile/modules/sd-core/ios/crate/Cargo.toml @@ -2,10 +2,10 @@ name = "sd-mobile-ios" version = "0.1.0" -edition.workspace = true -license.workspace = true -repository.workspace = true -rust-version = "1.64" +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true [lib] # iOS requires static linking diff --git a/core/Cargo.toml b/core/Cargo.toml index cc499eae2..64a46ff31 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -2,12 +2,12 @@ name = "sd-core" version = "0.4.2" -authors = ["Spacedrive Technology Inc "] -description = "Virtual distributed filesystem engine that powers Spacedrive." -edition.workspace = true -license.workspace = true -repository.workspace = true -rust-version = "1.78" +authors = ["Spacedrive Technology Inc "] +description = "Virtual distributed filesystem engine that powers Spacedrive." +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true [features] default = [] @@ -57,7 +57,6 @@ image = { workspace = true } itertools = { workspace = true } libc = { workspace = true } normpath = { workspace = true, features = ["localization"] } -once_cell = { workspace = true } pin-project-lite = { workspace = true } prisma-client-rust = { workspace = true, features = ["rspc"] } regex = { workspace = true } diff --git a/core/crates/file-path-helper/Cargo.toml b/core/crates/file-path-helper/Cargo.toml index 94960869b..87f79968e 100644 --- a/core/crates/file-path-helper/Cargo.toml +++ b/core/crates/file-path-helper/Cargo.toml @@ -2,12 +2,12 @@ name = "sd-core-file-path-helper" version = "0.1.0" -authors = ["Ericson Soares "] -edition.workspace = true -license.workspace = true -readme = "README.md" -repository.workspace = true -rust-version = "1.75" +authors = ["Ericson Soares "] +edition.workspace = true +license.workspace = true +readme = "README.md" +repository.workspace = true +rust-version.workspace = true [dependencies] # Inner Core Sub-crates diff --git a/core/crates/heavy-lifting/Cargo.toml b/core/crates/heavy-lifting/Cargo.toml index cf69c7d6b..75e99359c 100644 --- a/core/crates/heavy-lifting/Cargo.toml +++ b/core/crates/heavy-lifting/Cargo.toml @@ -40,7 +40,6 @@ globset = { workspace = true } image = { workspace = true } itertools = { workspace = true } lending-stream = { workspace = true } -once_cell = { workspace = true } prisma-client-rust = { workspace = true } rmp-serde = { workspace = true } rmpv = { workspace = true } diff --git a/core/crates/heavy-lifting/src/job_system/job.rs b/core/crates/heavy-lifting/src/job_system/job.rs index 0a3642797..fe8694c72 100644 --- a/core/crates/heavy-lifting/src/job_system/job.rs +++ b/core/crates/heavy-lifting/src/job_system/job.rs @@ -1167,7 +1167,8 @@ impl JobTaskDispatcher { matches!( *state, JobRunningState::Running - | JobRunningState::Canceled | JobRunningState::Shutdown + | JobRunningState::Canceled + | JobRunningState::Shutdown ) }) .await diff --git a/core/crates/heavy-lifting/src/job_system/report.rs b/core/crates/heavy-lifting/src/job_system/report.rs index 06cba2af9..a0ec935c9 100644 --- a/core/crates/heavy-lifting/src/job_system/report.rs +++ b/core/crates/heavy-lifting/src/job_system/report.rs @@ -344,8 +344,10 @@ impl Status { matches!( self, Self::Completed - | Self::Canceled | Self::Paused - | Self::Failed | Self::CompletedWithErrors + | Self::Canceled + | Self::Paused + | Self::Failed + | Self::CompletedWithErrors ) } } diff --git a/core/crates/heavy-lifting/src/job_system/store.rs b/core/crates/heavy-lifting/src/job_system/store.rs index 74058708a..82847dadc 100644 --- a/core/crates/heavy-lifting/src/job_system/store.rs +++ b/core/crates/heavy-lifting/src/job_system/store.rs @@ -83,7 +83,9 @@ pub async fn load_jobs>( root_job: StoredJob { id, .. }, next_jobs, .. - }| { iter::once(*id).chain(next_jobs.iter().map(|StoredJob { id, .. }| *id)) }, + }| { + iter::once(*id).chain(next_jobs.iter().map(|StoredJob { id, .. }| *id)) + }, ) .map(|job_id| uuid_to_bytes(&job_id)) .collect::>(), diff --git a/core/crates/heavy-lifting/src/media_processor/helpers/exif_media_data.rs b/core/crates/heavy-lifting/src/media_processor/helpers/exif_media_data.rs index 306984fc9..5e1ea5ce7 100644 --- a/core/crates/heavy-lifting/src/media_processor/helpers/exif_media_data.rs +++ b/core/crates/heavy-lifting/src/media_processor/helpers/exif_media_data.rs @@ -12,14 +12,13 @@ use sd_prisma::{ use sd_sync::{option_sync_db_entry, OperationFactory}; use sd_utils::chain_optional_iter; -use std::path::Path; +use std::{path::Path, sync::LazyLock}; use futures_concurrency::future::TryJoin; -use once_cell::sync::Lazy; use super::from_slice_option_to_option; -pub static AVAILABLE_EXTENSIONS: Lazy> = Lazy::new(|| { +pub static AVAILABLE_EXTENSIONS: LazyLock> = LazyLock::new(|| { ALL_IMAGE_EXTENSIONS .iter() .copied() diff --git a/core/crates/heavy-lifting/src/media_processor/helpers/ffmpeg_media_data.rs b/core/crates/heavy-lifting/src/media_processor/helpers/ffmpeg_media_data.rs index ebcc65a63..30b63718d 100644 --- a/core/crates/heavy-lifting/src/media_processor/helpers/ffmpeg_media_data.rs +++ b/core/crates/heavy-lifting/src/media_processor/helpers/ffmpeg_media_data.rs @@ -26,16 +26,15 @@ use sd_utils::{ i64_to_frontend, }; -use std::{collections::HashMap, path::Path}; +use std::{collections::HashMap, path::Path, sync::LazyLock}; use futures_concurrency::future::TryJoin; -use once_cell::sync::Lazy; use prisma_client_rust::QueryError; use tracing::error; use super::from_slice_option_to_option; -pub static AVAILABLE_EXTENSIONS: Lazy> = Lazy::new(|| { +pub static AVAILABLE_EXTENSIONS: LazyLock> = LazyLock::new(|| { ALL_AUDIO_EXTENSIONS .iter() .copied() @@ -61,12 +60,15 @@ pub const fn can_extract_for_audio(audio_extension: AudioExtension) -> bool { matches!( audio_extension, Mp3 | Mp2 - | M4a | Wav | Aiff - | Aif | Flac | Ogg - | Oga | Opus | Wma - | Amr | Aac | Wv - | Voc | Tta | Loas - | Caf | Aptx | Adts + | M4a | Wav + | Aiff | Aif + | Flac | Ogg + | Oga | Opus + | Wma | Amr + | Aac | Wv + | Voc | Tta + | Loas | Caf + | Aptx | Adts | Ast | Mid ) } @@ -81,15 +83,18 @@ pub const fn can_extract_for_video(video_extension: VideoExtension) -> bool { matches!( video_extension, Avi | Avifs - | Qt | Mov | Swf - | Mjpeg | Mpeg - | Mxf | M2v | Mpg - | Mpe | M2ts | Flv - | Wm | _3gp | M4v - | Wmv | Asf | Mp4 - | Webm | Mkv | Vob - | Ogv | Wtv | Hevc - | F4v // | Ts | Mts TODO: Uncomment when we start using magic instead of extension + | Qt | Mov + | Swf | Mjpeg + | Mpeg | Mxf + | M2v | Mpg + | Mpe | M2ts + | Flv | Wm + | _3gp | M4v + | Wmv | Asf + | Mp4 | Webm + | Mkv | Vob + | Ogv | Wtv + | Hevc | F4v // | Ts | Mts TODO: Uncomment when we start using magic instead of extension ) } diff --git a/core/crates/heavy-lifting/src/media_processor/helpers/thumbnailer.rs b/core/crates/heavy-lifting/src/media_processor/helpers/thumbnailer.rs index adcdaae61..947757a4c 100644 --- a/core/crates/heavy-lifting/src/media_processor/helpers/thumbnailer.rs +++ b/core/crates/heavy-lifting/src/media_processor/helpers/thumbnailer.rs @@ -17,11 +17,11 @@ use std::{ panic, path::{Path, PathBuf}, str::FromStr, + sync::LazyLock, time::Duration, }; use image::{imageops, DynamicImage, GenericImageView}; -use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use specta::Type; use tokio::{ @@ -55,7 +55,7 @@ pub fn get_thumbnails_directory(data_directory: impl AsRef) -> PathBuf { } #[cfg(feature = "ffmpeg")] -pub static THUMBNAILABLE_VIDEO_EXTENSIONS: Lazy> = Lazy::new(|| { +pub static THUMBNAILABLE_VIDEO_EXTENSIONS: LazyLock> = LazyLock::new(|| { ALL_VIDEO_EXTENSIONS .iter() .copied() @@ -64,7 +64,7 @@ pub static THUMBNAILABLE_VIDEO_EXTENSIONS: Lazy> = Lazy::new(|| { .collect() }); -pub static THUMBNAILABLE_EXTENSIONS: Lazy> = Lazy::new(|| { +pub static THUMBNAILABLE_EXTENSIONS: LazyLock> = LazyLock::new(|| { ALL_IMAGE_EXTENSIONS .iter() .copied() @@ -80,7 +80,7 @@ pub static THUMBNAILABLE_EXTENSIONS: Lazy> = Lazy::new(|| { .collect() }); -pub static ALL_THUMBNAILABLE_EXTENSIONS: Lazy> = Lazy::new(|| { +pub static ALL_THUMBNAILABLE_EXTENSIONS: LazyLock> = LazyLock::new(|| { #[cfg(feature = "ffmpeg")] return THUMBNAILABLE_EXTENSIONS .iter() @@ -101,6 +101,11 @@ static WEBP_CONFIG: std::sync::LazyLock = std::sync::LazyLock::new(| config }); +const HALF_SEC: Duration = Duration::from_millis(500); + +static LAST_SINGLE_THUMB_GENERATED_LOCK: LazyLock> = + LazyLock::new(|| Mutex::new(Instant::now())); + /// This type is used to pass the relevant data to the frontend so it can request the thumbnail. /// Tt supports extending the shard hex to support deeper directory structures in the future #[derive(Debug, Serialize, Deserialize, Type, Clone)] @@ -487,10 +492,6 @@ async fn generate_video_thumbnail( }) } -const HALF_SEC: Duration = Duration::from_millis(500); -static LAST_SINGLE_THUMB_GENERATED_LOCK: Lazy> = - Lazy::new(|| Mutex::new(Instant::now())); - /// WARNING!!!! DON'T USE THIS FUNCTION IN A LOOP!!!!!!!!!!!!! It will be pretty slow on purpose! pub async fn generate_single_thumbnail( thumbnails_directory: impl AsRef + Send, diff --git a/core/crates/indexer-rules/Cargo.toml b/core/crates/indexer-rules/Cargo.toml index e79efb83b..218f04d75 100644 --- a/core/crates/indexer-rules/Cargo.toml +++ b/core/crates/indexer-rules/Cargo.toml @@ -16,7 +16,6 @@ sd-utils = { path = "../../../crates/utils" } chrono = { workspace = true } futures-concurrency = { workspace = true } globset = { workspace = true, features = ["serde1"] } -once_cell = { workspace = true } prisma-client-rust = { workspace = true } rmp-serde = { workspace = true } rspc = { workspace = true } diff --git a/core/crates/indexer-rules/src/seed.rs b/core/crates/indexer-rules/src/seed.rs index 173514630..a9dc2fdf0 100644 --- a/core/crates/indexer-rules/src/seed.rs +++ b/core/crates/indexer-rules/src/seed.rs @@ -1,11 +1,13 @@ use sd_prisma::prisma::{indexer_rule, PrismaClient}; -use std::path::{Path, PathBuf}; +use std::{ + path::{Path, PathBuf}, + sync::LazyLock, +}; use chrono::Utc; use futures_concurrency::future::Join; use gix_ignore::{glob::search::pattern::List, search::Ignore, Search}; -use once_cell::sync::Lazy; use tokio::fs; use uuid::Uuid; @@ -205,7 +207,7 @@ pub async fn new_or_existing_library(db: &PrismaClient) -> Result<(), SeederErro Ok(()) } -pub static NO_SYSTEM_FILES: Lazy = Lazy::new(|| { +pub static NO_SYSTEM_FILES: LazyLock = LazyLock::new(|| { SystemIndexerRule { // TODO: On windows, beside the listed files, any file with the FILE_ATTRIBUTE_SYSTEM should be considered a system file // https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants#FILE_ATTRIBUTE_SYSTEM @@ -311,14 +313,14 @@ pub static NO_SYSTEM_FILES: Lazy = Lazy::new(|| { } }); -pub static NO_HIDDEN: Lazy = Lazy::new(|| SystemIndexerRule { +pub static NO_HIDDEN: LazyLock = LazyLock::new(|| SystemIndexerRule { name: "No Hidden files", default: false, rules: vec![RulePerKind::new_reject_files_by_globs_str(["**/.*"]) .expect("this is hardcoded and should always work")], }); -pub static NO_GIT: Lazy = Lazy::new(|| SystemIndexerRule { +pub static NO_GIT: LazyLock = LazyLock::new(|| SystemIndexerRule { name: "No Git files", default: true, rules: vec![RulePerKind::new_reject_files_by_globs_str([ @@ -327,14 +329,14 @@ pub static NO_GIT: Lazy = Lazy::new(|| SystemIndexerRule { .expect("this is hardcoded and should always work")], }); -pub static GITIGNORE: Lazy = Lazy::new(|| SystemIndexerRule { +pub static GITIGNORE: LazyLock = LazyLock::new(|| SystemIndexerRule { name: "Gitignore", default: true, // Empty rules because this rule is only used to allow frontend to toggle GitIgnoreRules rules: vec![], }); -pub static ONLY_IMAGES: Lazy = Lazy::new(|| SystemIndexerRule { +pub static ONLY_IMAGES: LazyLock = LazyLock::new(|| SystemIndexerRule { name: "Only Images", default: false, rules: vec![RulePerKind::new_accept_files_by_globs_str([ diff --git a/core/src/api/libraries.rs b/core/src/api/libraries.rs index e0c64d6dd..32e5d36da 100644 --- a/core/src/api/libraries.rs +++ b/core/src/api/libraries.rs @@ -20,7 +20,7 @@ use std::{ pin::pin, sync::{ atomic::{AtomicBool, Ordering}, - Arc, + Arc, LazyLock, }, time::Duration, }; @@ -32,7 +32,6 @@ use futures_concurrency::{ future::{Join, TryJoin}, stream::Merge, }; -use once_cell::sync::Lazy; use prisma_client_rust::{raw, QueryError}; use rspc::{alpha::AlphaRouter, ErrorCode}; use serde::{Deserialize, Serialize}; @@ -54,10 +53,11 @@ const TWO_MINUTES: Duration = Duration::from_secs(60 * 2); const FIVE_MINUTES: Duration = Duration::from_secs(60 * 5); static IS_COMPUTING_KIND_STATISTICS: AtomicBool = AtomicBool::new(false); -static LAST_KIND_STATISTICS_UPDATE: Lazy> = Lazy::new(RwLock::default); +static LAST_KIND_STATISTICS_UPDATE: LazyLock> = + LazyLock::new(RwLock::default); -static STATISTICS_UPDATERS: Lazy>>> = - Lazy::new(|| Mutex::new(HashMap::new())); +static STATISTICS_UPDATERS: LazyLock>>> = + LazyLock::new(|| Mutex::new(HashMap::new())); struct TotalFilesStatistics { updated_at: Instant, diff --git a/core/src/location/mod.rs b/core/src/location/mod.rs index d613aca4e..79ed55466 100644 --- a/core/src/location/mod.rs +++ b/core/src/location/mod.rs @@ -752,7 +752,8 @@ async fn create_location( .location() .count(vec![location::path::equals(Some(path.clone()))]) .exec() - .await? > 0 + .await? + > 0 { return Err(LocationError::LocationAlreadyExists(location_path.into())); } diff --git a/core/src/object/fs/mod.rs b/core/src/object/fs/mod.rs index 46b6afa67..93f748651 100644 --- a/core/src/object/fs/mod.rs +++ b/core/src/object/fs/mod.rs @@ -13,9 +13,9 @@ use tracing::trace; use std::{ ffi::OsStr, path::{Path, PathBuf}, + sync::LazyLock, }; -use once_cell::sync::Lazy; use regex::Regex; use serde::{Deserialize, Serialize}; @@ -33,8 +33,8 @@ pub mod error; use error::FileSystemJobsError; use tokio::{fs, io}; -static DUPLICATE_PATTERN: Lazy = - Lazy::new(|| Regex::new(r" \(\d+\)").expect("Failed to compile hardcoded regex")); +static DUPLICATE_PATTERN: LazyLock = + LazyLock::new(|| Regex::new(r" \(\d+\)").expect("Failed to compile hardcoded regex")); // pub const BYTES_EXT: &str = ".bytes"; diff --git a/core/src/old_job/report.rs b/core/src/old_job/report.rs index 60761ab17..ed40df23d 100644 --- a/core/src/old_job/report.rs +++ b/core/src/old_job/report.rs @@ -418,8 +418,10 @@ impl JobStatus { matches!( self, Self::Completed - | Self::Canceled | Self::Paused - | Self::Failed | Self::CompletedWithErrors + | Self::Canceled + | Self::Paused + | Self::Failed + | Self::CompletedWithErrors ) } } diff --git a/crates/ai/Cargo.toml b/crates/ai/Cargo.toml index 78c7d2076..e24bd3c0c 100644 --- a/crates/ai/Cargo.toml +++ b/crates/ai/Cargo.toml @@ -2,13 +2,13 @@ name = "sd-ai" version = "0.1.0" -authors = ["Ericson Soares "] -description = "A simple library to generate video thumbnails using ffmpeg with the webp format" -edition.workspace = true -license.workspace = true -readme = "README.md" -repository.workspace = true -rust-version = "1.75" +authors = ["Ericson Soares "] +description = "A simple library to generate video thumbnails using ffmpeg with the webp format" +edition.workspace = true +license.workspace = true +readme = "README.md" +repository.workspace = true +rust-version.workspace = true [dependencies] # Inner Core Sub-crates @@ -26,7 +26,6 @@ chrono = { workspace = true, features = ["serde"] } futures = { workspace = true } futures-concurrency = { workspace = true } image = { workspace = true } -once_cell = { workspace = true } prisma-client-rust = { workspace = true } reqwest = { workspace = true, features = ["native-tls-vendored", "stream"] } rmp-serde = { workspace = true } diff --git a/crates/ai/src/old_image_labeler/model/yolov8.rs b/crates/ai/src/old_image_labeler/model/yolov8.rs index 701292d54..8440c9a7f 100644 --- a/crates/ai/src/old_image_labeler/model/yolov8.rs +++ b/crates/ai/src/old_image_labeler/model/yolov8.rs @@ -4,12 +4,12 @@ use std::{ collections::{HashMap, HashSet}, fmt::Display, path::Path, + sync::LazyLock, }; use half::f16; use image::{imageops::FilterType, load_from_memory_with_format, GenericImageView, ImageFormat}; use ndarray::{s, Array, Axis}; -use once_cell::sync::Lazy; use ort::{inputs, SessionInputs, SessionOutputs}; use url::Url; @@ -32,7 +32,7 @@ const MODEL_LOCATION: &str = if cfg!(target_os = "macos") { pub static DEFAULT_MODEL_VERSION: &str = "Yolo Small"; -static MODEL_VERSIONS: Lazy> = Lazy::new(|| { +static MODEL_VERSIONS: LazyLock> = LazyLock::new(|| { HashMap::from([ ("Yolo Nano", ModelSource::Url(Url::parse("https://github.com/spacedriveapp/native-deps/releases/download/yolo-2023-12-05/yolov8n.onnx").expect("Must be a valid URL"))), (DEFAULT_MODEL_VERSION, ModelSource::Path(get_path_relative_to_exe(Path::new(MODEL_LOCATION).join("yolov8s.onnx")))), diff --git a/crates/ffmpeg/Cargo.toml b/crates/ffmpeg/Cargo.toml index ea6e3ff0c..dda5c3a3c 100644 --- a/crates/ffmpeg/Cargo.toml +++ b/crates/ffmpeg/Cargo.toml @@ -2,13 +2,13 @@ name = "sd-ffmpeg" version = "0.1.0" -authors = ["Ericson Soares ", "Vítor Vasconcellos "] -description = "A simple library to generate video thumbnails using ffmpeg with the webp format" -edition.workspace = true -license.workspace = true -readme = "README.md" -repository.workspace = true -rust-version = "1.78" +authors = ["Ericson Soares ", "Vítor Vasconcellos "] +description = "A simple library to generate video thumbnails using ffmpeg with the webp format" +edition.workspace = true +license.workspace = true +readme = "README.md" +repository.workspace = true +rust-version.workspace = true [dependencies] # Spacedrive Sub-crates diff --git a/crates/images/Cargo.toml b/crates/images/Cargo.toml index d6cda860f..3835927d2 100644 --- a/crates/images/Cargo.toml +++ b/crates/images/Cargo.toml @@ -13,7 +13,6 @@ heif = ["dep:libheif-rs", "dep:libheif-sys"] [dependencies] # Workspace dependencies image = { workspace = true } -once_cell = { workspace = true } rspc = { workspace = true, optional = true } # error conversion serde = { workspace = true, optional = true, features = ["derive"] } specta = { workspace = true, optional = true } diff --git a/crates/images/src/heif.rs b/crates/images/src/heif.rs index e698ec120..bbd999cf2 100644 --- a/crates/images/src/heif.rs +++ b/crates/images/src/heif.rs @@ -2,12 +2,12 @@ pub use crate::error::{Error, Result}; use crate::ImageHandler; use image::DynamicImage; use libheif_rs::{ColorSpace, HeifContext, LibHeif, RgbChroma}; -use once_cell::sync::Lazy; use std::io::{Cursor, SeekFrom}; use std::io::{Read, Seek}; use std::path::Path; +use std::sync::LazyLock; -static HEIF: Lazy = Lazy::new(LibHeif::new); +static HEIF: LazyLock = LazyLock::new(LibHeif::new); pub struct HeifHandler {} diff --git a/crates/images/src/pdf.rs b/crates/images/src/pdf.rs index 96dcef373..bc89656f2 100644 --- a/crates/images/src/pdf.rs +++ b/crates/images/src/pdf.rs @@ -1,6 +1,7 @@ use std::{ env::current_exe, path::{Path, PathBuf}, + sync::LazyLock, }; use crate::{ @@ -8,7 +9,6 @@ use crate::{ ImageHandler, Result, }; use image::DynamicImage; -use once_cell::sync::Lazy; use pdfium_render::prelude::{PdfColor, PdfPageRenderRotation, PdfRenderConfig, Pdfium}; use tracing::error; @@ -22,7 +22,7 @@ const BINDING_LOCATION: &str = if cfg!(target_os = "macos") { "../lib/spacedrive" }; -static PDFIUM_LIB: Lazy = Lazy::new(|| { +static PDFIUM_LIB: LazyLock = LazyLock::new(|| { let lib_name = Pdfium::pdfium_platform_library_name(); current_exe() .ok() @@ -65,11 +65,11 @@ fn thumbnail_config(config: PdfRenderConfig) -> PdfRenderConfig { .clear_before_rendering(true) } -static PORTRAIT_CONFIG: Lazy = Lazy::new(|| { +static PORTRAIT_CONFIG: LazyLock = LazyLock::new(|| { thumbnail_config(PdfRenderConfig::new().set_target_width(PDF_PORTRAIT_RENDER_WIDTH)) }); -static LANDSCAPE_CONFIG: Lazy = Lazy::new(|| { +static LANDSCAPE_CONFIG: LazyLock = LazyLock::new(|| { thumbnail_config(PdfRenderConfig::new().set_target_width(PDF_LANDSCAPE_RENDER_WIDTH)) }); diff --git a/crates/sync/example/Cargo.toml b/crates/sync/example/Cargo.toml index 49521583a..6893daee8 100644 --- a/crates/sync/example/Cargo.toml +++ b/crates/sync/example/Cargo.toml @@ -2,11 +2,11 @@ name = "sd-sync-example" version = "0.1.0" -edition.workspace = true -license.workspace = true -publish = false -repository.workspace = true -rust-version = "1.64" +edition.workspace = true +license.workspace = true +publish = false +repository.workspace = true +rust-version.workspace = true [dependencies] # Spacedrive Sub-crates diff --git a/crates/task-system/Cargo.toml b/crates/task-system/Cargo.toml index 03e31ba60..ca9bfc521 100644 --- a/crates/task-system/Cargo.toml +++ b/crates/task-system/Cargo.toml @@ -2,11 +2,11 @@ name = "sd-task-system" version = "0.1.0" -authors = ["Ericson Soares "] -edition.workspace = true -license.workspace = true -repository.workspace = true -rust-version = "1.75" +authors = ["Ericson Soares "] +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true [dependencies] # Workspace deps diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 8cca5be05..4cef0b738 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.80" +channel = "1.81"