mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 04:15:14 +08:00
chore: establish development baseline
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
[package]
|
||||
name = "bat-patch"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
thiserror.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
blake3.workspace = true
|
||||
|
||||
# Binary diff/patch
|
||||
bsdiff = "0.2"
|
||||
|
||||
# JSON patch
|
||||
json-patch = "4.2"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.14"
|
||||
@@ -0,0 +1,6 @@
|
||||
//! Binary Patch 模块占位
|
||||
|
||||
/// Binary Patch 应用(待实现)
|
||||
pub fn apply_patch(_old: &[u8], _patch: &[u8]) -> crate::Result<Vec<u8>> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//! Patch 错误类型定义
|
||||
|
||||
use thiserror::Error;
|
||||
|
||||
/// Patch 错误类型
|
||||
#[derive(Error, Debug)]
|
||||
pub enum PatchError {
|
||||
/// IO 错误
|
||||
#[error("IO error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
|
||||
/// Patch 应用失败
|
||||
#[error("Patch apply failed: {0}")]
|
||||
ApplyFailed(String),
|
||||
|
||||
/// 其他错误
|
||||
#[error(transparent)]
|
||||
Other(#[from] anyhow::Error),
|
||||
}
|
||||
|
||||
/// Patch Result 类型
|
||||
pub type Result<T> = std::result::Result<T, PatchError>;
|
||||
@@ -0,0 +1,6 @@
|
||||
//! JSON Patch 模块占位
|
||||
|
||||
/// JSON Patch 应用(待实现)
|
||||
pub fn apply_json_patch(_doc: &str, _patch: &str) -> crate::Result<String> {
|
||||
Ok(String::new())
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
//! # BAT Patch
|
||||
//!
|
||||
//! Patch 引擎核心实现
|
||||
//!
|
||||
//! 支持:
|
||||
//! - Binary Diff/Patch
|
||||
//! - JSON Patch
|
||||
//! - Rollback
|
||||
//! - Integrity Check
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![warn(clippy::all)]
|
||||
|
||||
pub mod error;
|
||||
pub mod binary;
|
||||
pub mod json;
|
||||
|
||||
pub use error::{PatchError, Result};
|
||||
|
||||
/// Patch 引擎版本号
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
Reference in New Issue
Block a user