mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
uucore: Move extendedbigdecimal to its own feature
This will be needed later on so that we can split format and parse features.
This commit is contained in:
parent
97fb15b02d
commit
a937aa5117
10 changed files with 31 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
||||||
# spell-checker:ignore bigdecimal cfgs
|
# spell-checker:ignore bigdecimal cfgs extendedbigdecimal
|
||||||
[package]
|
[package]
|
||||||
name = "uu_seq"
|
name = "uu_seq"
|
||||||
version = "0.0.30"
|
version = "0.0.30"
|
||||||
|
@ -23,7 +23,11 @@ clap = { workspace = true }
|
||||||
num-bigint = { workspace = true }
|
num-bigint = { workspace = true }
|
||||||
num-traits = { workspace = true }
|
num-traits = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
uucore = { workspace = true, features = ["format", "quoting-style"] }
|
uucore = { workspace = true, features = [
|
||||||
|
"extendedbigdecimal",
|
||||||
|
"format",
|
||||||
|
"quoting-style",
|
||||||
|
] }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "seq"
|
name = "seq"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// spell-checker:ignore extendedbigdecimal
|
// spell-checker:ignore extendedbigdecimal
|
||||||
use num_traits::Zero;
|
use num_traits::Zero;
|
||||||
|
|
||||||
use uucore::format::ExtendedBigDecimal;
|
use uucore::extendedbigdecimal::ExtendedBigDecimal;
|
||||||
|
|
||||||
/// A number with a specified number of integer and fractional digits.
|
/// A number with a specified number of integer and fractional digits.
|
||||||
///
|
///
|
||||||
|
|
|
@ -12,7 +12,7 @@ use std::str::FromStr;
|
||||||
use uucore::format::num_parser::{ExtendedParser, ExtendedParserError};
|
use uucore::format::num_parser::{ExtendedParser, ExtendedParserError};
|
||||||
|
|
||||||
use crate::number::PreciseNumber;
|
use crate::number::PreciseNumber;
|
||||||
use uucore::format::ExtendedBigDecimal;
|
use uucore::extendedbigdecimal::ExtendedBigDecimal;
|
||||||
|
|
||||||
/// An error returned when parsing a number fails.
|
/// An error returned when parsing a number fails.
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
|
@ -126,7 +126,7 @@ impl FromStr for PreciseNumber {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use bigdecimal::BigDecimal;
|
use bigdecimal::BigDecimal;
|
||||||
use uucore::format::ExtendedBigDecimal;
|
use uucore::extendedbigdecimal::ExtendedBigDecimal;
|
||||||
|
|
||||||
use crate::number::PreciseNumber;
|
use crate::number::PreciseNumber;
|
||||||
use crate::numberparse::ParseNumberError;
|
use crate::numberparse::ParseNumberError;
|
||||||
|
|
|
@ -10,8 +10,9 @@ use clap::{Arg, ArgAction, Command};
|
||||||
use num_traits::Zero;
|
use num_traits::Zero;
|
||||||
|
|
||||||
use uucore::error::{FromIo, UResult};
|
use uucore::error::{FromIo, UResult};
|
||||||
|
use uucore::extendedbigdecimal::ExtendedBigDecimal;
|
||||||
use uucore::format::num_format::FloatVariant;
|
use uucore::format::num_format::FloatVariant;
|
||||||
use uucore::format::{ExtendedBigDecimal, Format, num_format};
|
use uucore::format::{Format, num_format};
|
||||||
use uucore::{format_usage, help_about, help_usage};
|
use uucore::{format_usage, help_about, help_usage};
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# spell-checker:ignore (features) bigdecimal zerocopy
|
# spell-checker:ignore (features) bigdecimal zerocopy extendedbigdecimal
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "uucore"
|
name = "uucore"
|
||||||
|
@ -92,11 +92,18 @@ colors = []
|
||||||
checksum = ["data-encoding", "thiserror", "sum"]
|
checksum = ["data-encoding", "thiserror", "sum"]
|
||||||
encoding = ["data-encoding", "data-encoding-macro", "z85"]
|
encoding = ["data-encoding", "data-encoding-macro", "z85"]
|
||||||
entries = ["libc"]
|
entries = ["libc"]
|
||||||
|
extendedbigdecimal = ["bigdecimal", "num-traits"]
|
||||||
fs = ["dunce", "libc", "winapi-util", "windows-sys"]
|
fs = ["dunce", "libc", "winapi-util", "windows-sys"]
|
||||||
fsext = ["libc", "windows-sys"]
|
fsext = ["libc", "windows-sys"]
|
||||||
fsxattr = ["xattr"]
|
fsxattr = ["xattr"]
|
||||||
lines = []
|
lines = []
|
||||||
format = ["bigdecimal", "itertools", "num-traits", "quoting-style"]
|
format = [
|
||||||
|
"bigdecimal",
|
||||||
|
"extendedbigdecimal",
|
||||||
|
"itertools",
|
||||||
|
"num-traits",
|
||||||
|
"quoting-style",
|
||||||
|
]
|
||||||
mode = ["libc"]
|
mode = ["libc"]
|
||||||
perms = ["entries", "libc", "walkdir"]
|
perms = ["entries", "libc", "walkdir"]
|
||||||
buf-copy = []
|
buf-copy = []
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
// For the full copyright and license information, please view the LICENSE
|
// For the full copyright and license information, please view the LICENSE
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
// features ~ feature-gated modules (core/bundler file)
|
// features ~ feature-gated modules (core/bundler file)
|
||||||
|
//
|
||||||
|
// spell-checker:ignore (features) extendedbigdecimal
|
||||||
|
|
||||||
#[cfg(feature = "backup-control")]
|
#[cfg(feature = "backup-control")]
|
||||||
pub mod backup_control;
|
pub mod backup_control;
|
||||||
|
@ -16,6 +18,8 @@ pub mod colors;
|
||||||
pub mod custom_tz_fmt;
|
pub mod custom_tz_fmt;
|
||||||
#[cfg(feature = "encoding")]
|
#[cfg(feature = "encoding")]
|
||||||
pub mod encoding;
|
pub mod encoding;
|
||||||
|
#[cfg(feature = "extendedbigdecimal")]
|
||||||
|
pub mod extendedbigdecimal;
|
||||||
#[cfg(feature = "format")]
|
#[cfg(feature = "format")]
|
||||||
pub mod format;
|
pub mod format;
|
||||||
#[cfg(feature = "fs")]
|
#[cfg(feature = "fs")]
|
||||||
|
|
|
@ -235,7 +235,7 @@ mod tests {
|
||||||
use bigdecimal::BigDecimal;
|
use bigdecimal::BigDecimal;
|
||||||
use num_traits::Zero;
|
use num_traits::Zero;
|
||||||
|
|
||||||
use crate::format::extendedbigdecimal::ExtendedBigDecimal;
|
use crate::extendedbigdecimal::ExtendedBigDecimal;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_addition_infinity() {
|
fn test_addition_infinity() {
|
|
@ -33,14 +33,13 @@
|
||||||
|
|
||||||
mod argument;
|
mod argument;
|
||||||
mod escape;
|
mod escape;
|
||||||
pub mod extendedbigdecimal;
|
|
||||||
pub mod human;
|
pub mod human;
|
||||||
pub mod num_format;
|
pub mod num_format;
|
||||||
pub mod num_parser;
|
pub mod num_parser;
|
||||||
mod spec;
|
mod spec;
|
||||||
|
|
||||||
|
use crate::extendedbigdecimal::ExtendedBigDecimal;
|
||||||
pub use argument::*;
|
pub use argument::*;
|
||||||
pub use extendedbigdecimal::ExtendedBigDecimal;
|
|
||||||
pub use spec::Spec;
|
pub use spec::Spec;
|
||||||
use std::{
|
use std::{
|
||||||
error::Error,
|
error::Error,
|
||||||
|
|
|
@ -15,7 +15,7 @@ use num_traits::Signed;
|
||||||
use num_traits::ToPrimitive;
|
use num_traits::ToPrimitive;
|
||||||
use num_traits::Zero;
|
use num_traits::Zero;
|
||||||
|
|
||||||
use crate::format::extendedbigdecimal::ExtendedBigDecimal;
|
use crate::extendedbigdecimal::ExtendedBigDecimal;
|
||||||
|
|
||||||
/// Base for number parsing
|
/// Base for number parsing
|
||||||
#[derive(Clone, Copy, PartialEq)]
|
#[derive(Clone, Copy, PartialEq)]
|
||||||
|
@ -486,7 +486,7 @@ mod tests {
|
||||||
|
|
||||||
use bigdecimal::BigDecimal;
|
use bigdecimal::BigDecimal;
|
||||||
|
|
||||||
use crate::format::ExtendedBigDecimal;
|
use crate::extendedbigdecimal::ExtendedBigDecimal;
|
||||||
|
|
||||||
use super::{ExtendedParser, ExtendedParserError};
|
use super::{ExtendedParser, ExtendedParserError};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//! library ~ (core/bundler file)
|
//! library ~ (core/bundler file)
|
||||||
// #![deny(missing_docs)] //TODO: enable this
|
// #![deny(missing_docs)] //TODO: enable this
|
||||||
//
|
//
|
||||||
// spell-checker:ignore sigaction SIGBUS SIGSEGV
|
// spell-checker:ignore sigaction SIGBUS SIGSEGV extendedbigdecimal
|
||||||
|
|
||||||
// * feature-gated external crates (re-shared as public internal modules)
|
// * feature-gated external crates (re-shared as public internal modules)
|
||||||
#[cfg(feature = "libc")]
|
#[cfg(feature = "libc")]
|
||||||
|
@ -50,6 +50,8 @@ pub use crate::features::colors;
|
||||||
pub use crate::features::custom_tz_fmt;
|
pub use crate::features::custom_tz_fmt;
|
||||||
#[cfg(feature = "encoding")]
|
#[cfg(feature = "encoding")]
|
||||||
pub use crate::features::encoding;
|
pub use crate::features::encoding;
|
||||||
|
#[cfg(feature = "extendedbigdecimal")]
|
||||||
|
pub use crate::features::extendedbigdecimal;
|
||||||
#[cfg(feature = "format")]
|
#[cfg(feature = "format")]
|
||||||
pub use crate::features::format;
|
pub use crate::features::format;
|
||||||
#[cfg(feature = "fs")]
|
#[cfg(feature = "fs")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue