From b3ca08d7da9820d1dff0592ec6e5da7d874c0b6a Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Sat, 20 Dec 2025 09:52:54 -0800 Subject: [PATCH 1/3] Add `PrimitiveInteger::from_str_radix` (cherry picked from commit d2686256105d72b87afefbc96b098a644ae276ce) --- src/integer.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/integer.rs b/src/integer.rs index cdc1519..9ed29d4 100644 --- a/src/integer.rs +++ b/src/integer.rs @@ -1,3 +1,5 @@ +use core::num::ParseIntError; + use crate::{PrimitiveError, PrimitiveNumber, PrimitiveNumberRef}; /// Trait for all primitive [integer types], including the supertrait [`PrimitiveNumber`]. @@ -263,6 +265,9 @@ pub trait PrimitiveInteger: /// Converts an integer from little endian to the target's endianness. fn from_le(value: Self) -> Self; + /// Parses an integer from a string slice with digits in a given base. + fn from_str_radix(src: &str, radix: u32) -> Result; + /// Returns the logarithm of the number with respect to an arbitrary base, rounded down. fn ilog(self, base: Self) -> u32; @@ -537,6 +542,7 @@ macro_rules! impl_integer { forward! { fn from_be(value: Self) -> Self; fn from_le(value: Self) -> Self; + fn from_str_radix(src: &str, radix: u32) -> Result; } forward! { fn checked_add(self, rhs: Self) -> Option; From 30a74239684b3102f6ebac614e849d6c4c8b0f01 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Sat, 20 Dec 2025 13:32:04 -0800 Subject: [PATCH 2/3] CI: drop the branch filter for PRs --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 314692d..609e721 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,6 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] merge_group: jobs: From 38dacb2c02eb4ca8f511f84474bf67273efcb468 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Sat, 20 Dec 2025 13:37:06 -0800 Subject: [PATCH 3/3] Release 0.1.2 --- Cargo.lock | 2 +- Cargo.toml | 10 +++++----- RELEASES.md | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18764f0..fefd47d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,4 +4,4 @@ version = 4 [[package]] name = "num-primitive" -version = "0.1.1" +version = "0.1.2" diff --git a/Cargo.toml b/Cargo.toml index bdf3ce8..aaa42ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "num-primitive" -version = "0.1.1" +version = "0.1.2" description = "Traits for primitive numeric types" repository = "https://github.com/rust-num/num-primitive" license = "MIT OR Apache-2.0" @@ -9,6 +9,10 @@ categories = ["algorithms", "science", "no-std"] edition = "2024" rust-version = "1.85" +[package.metadata.release] +allow-branch = ["main"] +sign-tag = true + [features] default = ["std"] std = [] @@ -24,7 +28,3 @@ unreachable-pub = "deny" [lints.rustdoc] broken-intra-doc-links = "deny" private-intra-doc-links = "deny" - -[package.metadata.release] -allow-branch = ["main"] -sign-tag = true diff --git a/RELEASES.md b/RELEASES.md index 3ce1a74..06b86a5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,7 @@ +# Release 0.1.2 (2025-12-20) + +- Backported `PrimitiveInteger::from_str_radix` from 0.3.4. + # Release 0.1.1 (2025-12-11) - Link documentation to inherent methods.