Skip to content

Added num/malachite features for format crate #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rustpython-parser-vendored = { path = "vendored", version = "0.3.0" }
rustpython-ast = { path = "ast", default-features = false, version = "0.3.0" }
rustpython-parser-core = { path = "core", features = [], version = "0.3.0" }
rustpython-literal = { path = "literal", version = "0.3.0" }
rustpython-format = { path = "format", version = "0.3.0" }
rustpython-format = { path = "format", default-features = false, version = "0.3.0" }
rustpython-parser = { path = "parser", default-features = false, version = "0.3.0" }

anyhow = "1.0.45"
Expand Down
6 changes: 5 additions & 1 deletion format/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ repository = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[features]
default = ["malachite-bigint"]

[dependencies]
rustpython-literal = { workspace = true }

bitflags = { workspace = true }
itertools = { workspace = true }
malachite-bigint = { workspace = true }
malachite-bigint = { workspace = true, optional = true }
num-bigint = { workspace = true, optional = true }
num-traits = { workspace = true }
4 changes: 4 additions & 0 deletions format/src/bigint.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#[cfg(feature = "malachite-bigint")]
pub use malachite_bigint::{BigInt, Sign};
#[cfg(feature = "num-bigint")]
pub use num_bigint::{BigInt, Sign};
2 changes: 1 addition & 1 deletion format/src/cformat.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Implementation of Printf-Style string formatting
//! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting).
use crate::bigint::{BigInt, Sign};
use bitflags::bitflags;
use malachite_bigint::{BigInt, Sign};
use num_traits::Signed;
use rustpython_literal::{float, format::Case};
use std::{
Expand Down
2 changes: 1 addition & 1 deletion format/src/format.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::bigint::{BigInt, Sign};
use itertools::{Itertools, PeekingNext};
use malachite_bigint::{BigInt, Sign};
use num_traits::FromPrimitive;
use num_traits::{cast::ToPrimitive, Signed};
use rustpython_literal::float;
Expand Down
1 change: 1 addition & 0 deletions format/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod bigint;
pub mod cformat;
mod format;

Expand Down
2 changes: 1 addition & 1 deletion parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ phf_codegen = "0.11.1"
tiny-keccak = { version = "2", features = ["sha3"] }

[dependencies]
rustpython-ast = { workspace = true }
rustpython-ast = { workspace = true, default-features = false }
rustpython-parser-core = { workspace = true }

itertools = { workspace = true }
Expand Down