Skip to content

Commit

Permalink
fix: ⬆️ 更新上游依赖版本nar_dev_utils以统一下游的使用
Browse files Browse the repository at this point in the history
  • Loading branch information
ARCJ137442 committed Sep 4, 2024
1 parent f49446b commit 5dea0b9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 24 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "navm"
version = "0.17.2"
version = "0.17.3"
edition = "2021"
description = """
Definitions and APIs for the NAVM (Non-Axiomatic Virtual Machine) model
Expand Down Expand Up @@ -47,11 +47,11 @@ version = "1.0.81"
[dependencies.nar_dev_utils]
# 【2024-03-13 21:17:55】实用库现在独立为`nar_dev_utils`
# * 【2024-03-13 22:36:05】目前只启用它的宏
version = "0.38.0" # * ✅现已发布至`crates.io`
version = "0.40" # * ✅现已发布至`crates.io`
# path = "../NAR-dev-util"
# git = "https://github.com/ARCJ137442/NAR-dev-util"
# ! 【2024-03-23 19:19:01】似乎Rust-Analyzer无法获取私有仓库数据
features = []
features = ["bundled"]

[dependencies.narsese]
# ! 本地依赖可以不添加版本
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! 提供对「NAVM指令」的数据结构、解析支持
util::mod_and_pub_use! {
nar_dev_utils::mod_and_pub_use! {
// 结构
structs
// 格式化
Expand All @@ -13,7 +13,7 @@ util::mod_and_pub_use! {
#[cfg(test)]
mod tests {
use super::*;
use util::asserts;
use nar_dev_utils::asserts;

/// 测试/转换
/// * 🎯解析、格式化的稳定性:相等的指令
Expand Down
12 changes: 5 additions & 7 deletions src/cmd/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//! * 从字符串简要解析出NAVM指令指令类型
use super::Cmd;
use nar_dev_utils::{if_return, pipe};
use narsese::conversion::string::impl_lexical::format_instances::FORMAT_ASCII;
use std::{error::Error, fmt::Display};
use util::*;

/// 固定的「空字串」常量
/// * 📝定长数组非Copy初始化:如果需要在定长数组中初始化一个方法,应该先声明一个const,然后从中初始化
Expand Down Expand Up @@ -127,12 +127,10 @@ impl super::Cmd {
// 尝试解析
.parse(line)
// 转换其中的错误类型
.transform_err(to_parse_error)?;
.map_err(to_parse_error)?;
// 尝试进行隐式转换,以统一使用`Task`类型
// * ⚠️其中的「语句」将会被转换为「空预算任务」
let task = narsese
.try_into_task_compatible()
.transform_err(to_parse_error)?;
let task = narsese.try_into_task_compatible().map_err(to_parse_error)?;
// 返回
Cmd::NSE(task)
}
Expand All @@ -149,13 +147,13 @@ impl super::Cmd {
"CYC" => {
// 以空格分隔
let [num_str] = get_cmd_params::<1>(line)?;
let num = num_str.parse::<usize>().transform_err(to_parse_error)?;
let num = num_str.parse::<usize>().map_err(to_parse_error)?;
Cmd::CYC(num)
}
"VOL" => {
// 以空格分隔
let [num_str] = get_cmd_params::<1>(line)?;
let num = num_str.parse::<usize>().transform_err(to_parse_error)?;
let num = num_str.parse::<usize>().map_err(to_parse_error)?;
Cmd::VOL(num)
}
"REG" => {
Expand Down
6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
//! 库的主类
// 实用宏
// * 🚩内外使用规则:
// * 在自身`navm`内部使用`util`
// * 在外部(无法使用`crate`引用`navm`)使用`nar_dev_utils`
extern crate nar_dev_utils as util;

// 指令
pub mod cmd;

Expand Down
4 changes: 2 additions & 2 deletions src/output/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

use super::{Operation, Output};
use anyhow::{anyhow, Result};
use nar_dev_utils::{list, manipulate, pipe};
use narsese::conversion::string::impl_lexical::format_instances::FORMAT_ASCII;
use serde::{Deserialize, Serialize};
use util::{list, manipulate, pipe};

/// 用于统一存储「JSON化的NAVM输出」的结构
/// * 🎯对包含各种不同字段的枚举[`Output`]进行信息压缩
Expand Down Expand Up @@ -306,7 +306,7 @@ mod tests {
#[test]
#[cfg(feature = "serde_json")]
fn test_json_str() {
use util::asserts;
use nar_dev_utils::asserts;

let samples = test_samples();
// 各个样本的测试
Expand Down
4 changes: 2 additions & 2 deletions src/output/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
//! * 📄最初该类型定义在**BabelNAR** [^1] 中
//! * 🚩现在通过枚举统一定义
//!
//! ! 注意:内部导出了宏,所以不能用[`util::mod_and_pub_use`]合并
//! ! 注意:内部导出了宏,所以不能用[`nar_dev_utils::mod_and_pub_use`]合并
//!
//! [^1]: <https://github.com/ARCJ137442/BabelNAR.jl>
// 数据结构
mod structs;
pub use structs::*;

util::mods! {
nar_dev_utils::mods! {

// 转换
// * 🚩【2024-04-09 10:28:32】现在要求使用`serde`
Expand Down
2 changes: 1 addition & 1 deletion src/output/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
//! 🔗[GitHub链接](https://github.com/ARCJ137442/BabelNAR.jl/blob/main/src/CIN/struct/NARSOutputType.jl)
use anyhow::Result;
use nar_dev_utils::JoinTo;
use narsese::{
conversion::string::impl_lexical::format_instances::FORMAT_ASCII,
lexical::{Narsese as LexicalNarsese, Term as LexicalTerm},
};
use std::fmt::Display;
use util::JoinTo;

/// NAVM输出类型
/// * 🎯使用枚举,统一对「输出类别」分派
Expand Down
2 changes: 1 addition & 1 deletion src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! * 🚩【2024-03-22 17:29:07】目前将「输出」外迁到库的根目录,与「指令」「虚拟机」同级
//! * 📌理由:与Cmd基本平级、与VM相对独立
util::mod_and_pub_use! {
nar_dev_utils::mod_and_pub_use! {
// 结构
structs
// 特征
Expand Down

0 comments on commit 5dea0b9

Please sign in to comment.