Skip to content

Commit 37d360e

Browse files
committed
add tryfrom
1 parent 05814d6 commit 37d360e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/random.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ impl<'py> BitGeneratorMethods<'py> for Bound<'py, BitGenerator> {
4848
}
4949
}
5050

51+
impl<'py> TryFrom<&Bound<'py, BitGenerator>> for BitGen<'py> {
52+
type Error = PyErr;
53+
fn try_from(value: &Bound<'py, BitGenerator>) -> Result<Self, Self::Error> {
54+
value.bit_gen()
55+
}
56+
}
57+
5158
/// Wrapper for [`npy_bitgen`]
5259
pub struct BitGen<'a>(&'a mut npy_bitgen);
5360

0 commit comments

Comments
 (0)