Skip to content

Commit

Permalink
Fix: serde for Poisson
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Sep 13, 2024
1 parent 2dee225 commit d10fbd2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rand_distr/src/poisson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl fmt::Display for Error {
impl std::error::Error for Error {}

#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub(crate) struct KnuthMethod<F> {
exp_lambda: F,
}
Expand All @@ -90,12 +91,14 @@ impl<F: Float> KnuthMethod<F> {
}

#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
struct RejectionMethod<F> {
log_lambda: F,
sqrt_2lambda: F,
magic_val: F,
}
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
enum Method<F> {
Knuth(KnuthMethod<F>),
Rejection(RejectionMethod<F>),
Expand Down

0 comments on commit d10fbd2

Please sign in to comment.