Skip to content
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
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 = []
Expand All @@ -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
4 changes: 4 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 6 additions & 0 deletions src/integer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use core::num::ParseIntError;

use crate::{PrimitiveError, PrimitiveNumber, PrimitiveNumberRef};

/// Trait for all primitive [integer types], including the supertrait [`PrimitiveNumber`].
Expand Down Expand Up @@ -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<Self, ParseIntError>;

/// Returns the logarithm of the number with respect to an arbitrary base, rounded down.
fn ilog(self, base: Self) -> u32;

Expand Down Expand Up @@ -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<Self, ParseIntError>;
}
forward! {
fn checked_add(self, rhs: Self) -> Option<Self>;
Expand Down