Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Make malachite-bigint an optional dependency for rustpython-format #12

Merged
merged 1 commit into from
Jun 19, 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
3 changes: 2 additions & 1 deletion format/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ rustpython-literal = { workspace = true }

bitflags = "2.3.1"
itertools = "0.10.5"
malachite-bigint = { workspace = true }
num-traits = { workspace = true }
num-bigint = { workspace = true, optional = true }
malachite-bigint = { workspace = true, optional = true }
3 changes: 2 additions & 1 deletion format/src/cformat.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Implementation of Printf-Style string formatting
//! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting).
use bitflags::bitflags;
use malachite_bigint::{BigInt, Sign};
use num_traits::Signed;
use rustpython_literal::{float, format::Case};
use std::{
Expand All @@ -10,6 +9,8 @@ use std::{
str::FromStr,
};

use crate::bigint::{BigInt, Sign};

#[derive(Debug, PartialEq)]
pub enum CFormatErrorType {
UnmatchedKeyParentheses,
Expand Down
7 changes: 4 additions & 3 deletions format/src/format.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use itertools::{Itertools, PeekingNext};
use malachite_bigint::{BigInt, Sign};
use num_traits::FromPrimitive;
use num_traits::{cast::ToPrimitive, Signed};

use num_traits::{cast::ToPrimitive, FromPrimitive, Signed};
use rustpython_literal::float;
use rustpython_literal::format::Case;
use std::ops::Deref;
use std::{cmp, str::FromStr};

use crate::bigint::{BigInt, Sign};

trait FormatParse {
fn parse(text: &str) -> (Option<Self>, &str)
where
Expand Down
9 changes: 7 additions & 2 deletions format/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
pub mod cformat;
mod format;
#[cfg(feature = "malachite-bigint")]
pub use malachite_bigint as bigint;
#[cfg(feature = "num-bigint")]
pub use num_bigint as bigint;

pub use crate::format::*;

pub mod cformat;
mod format;