Skip to content

Commit 05814d6

Browse files
committed
less indirection
1 parent f52b2fa commit 05814d6

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/random.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,29 +51,21 @@ impl<'py> BitGeneratorMethods<'py> for Bound<'py, BitGenerator> {
5151
/// Wrapper for [`npy_bitgen`]
5252
pub struct BitGen<'a>(&'a mut npy_bitgen);
5353

54-
/// Methods for [`BitGen`]
55-
pub trait BitGenMethods {
54+
impl<'py> BitGen<'py> {
5655
/// Returns the next random unsigned 64 bit integer
57-
fn next_uint64(&self) -> u64;
58-
/// Returns the next random unsigned 32 bit integer
59-
fn next_uint32(&self) -> u32;
60-
/// Returns the next random double
61-
fn next_double(&self) -> libc::c_double;
62-
/// Returns the next raw value (can be used for testing)
63-
fn next_raw(&self) -> u64;
64-
}
65-
66-
impl<'py> BitGenMethods for BitGen<'py> {
67-
fn next_uint64(&self) -> u64 {
56+
pub fn next_uint64(&self) -> u64 {
6857
unsafe { (self.0.next_uint64)(self.0.state) }
6958
}
70-
fn next_uint32(&self) -> u32 {
59+
/// Returns the next random unsigned 32 bit integer
60+
pub fn next_uint32(&self) -> u32 {
7161
unsafe { (self.0.next_uint32)(self.0.state) }
7262
}
73-
fn next_double(&self) -> libc::c_double {
63+
/// Returns the next random double
64+
pub fn next_double(&self) -> libc::c_double {
7465
unsafe { (self.0.next_double)(self.0.state) }
7566
}
76-
fn next_raw(&self) -> u64 {
67+
/// Returns the next raw value (can be used for testing)
68+
pub fn next_raw(&self) -> u64 {
7769
unsafe { (self.0.next_raw)(self.0.state) }
7870
}
7971
}

0 commit comments

Comments
 (0)