refactor(Draft): management as crate (#5470)

* feat: implement draft functionality with apply and discard methods, and add benchmarks and tests

* Refactor Draft management and integrate Tokio for asynchronous operations

- Introduced a new `IVerge` struct for configuration management.
- Updated `Draft` struct to use `Arc<RwLock>` for better concurrency handling.
- Added asynchronous editing capabilities to `Draft` using Tokio.
- Replaced synchronous editing methods with asynchronous counterparts.
- Updated benchmark tests to reflect changes in the `Draft` API.
- Removed redundant draft utility module and integrated its functionality into the main `Draft` implementation.
- Adjusted tests to validate new behavior and ensure correctness of the `Draft` management flow.
This commit is contained in:
Tunglies
2025-11-16 00:33:21 +08:00
committed by GitHub
parent e66b8e7894
commit dbb4877be6
10 changed files with 181 additions and 131 deletions

View File

@@ -5,10 +5,11 @@ use crate::{
constants::{files, timing},
core::{CoreManager, handle, service, tray, validate::CoreConfigValidator},
enhance, logging, logging_error,
utils::{Draft, dirs, help, logging::Type},
utils::{dirs, help, logging::Type},
};
use anyhow::{Result, anyhow};
use backoff::{Error as BackoffError, ExponentialBackoff};
use draft::Draft;
use smartstring::alias::String;
use std::path::PathBuf;
use tokio::sync::OnceCell;