Skip to content

Commit

Permalink
Remove getset
Browse files Browse the repository at this point in the history
getset is no longer recommended by its maintainer: jbaublitz/getset#87 (comment)

& is thus unlikely to update to `syn 2`
  • Loading branch information
serprex committed Dec 26, 2023
1 parent c1beba7 commit 9eea435
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pest = { version = "2", optional = true }
pest_derive = { version = "2", optional = true }
strum = ">= 0.16, < 0.26"
strum_macros = ">= 0.16, < 0.26"
getset = ">=0.0.9, <0.2"
enum-map = ">=0.6.4, <3"
triple_accel = ">=0.3, <0.5"
thiserror = "1"
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ extern crate serde_derive;
#[macro_use]
extern crate strum_macros;

#[macro_use]
extern crate getset;

#[cfg(feature = "phylogeny")]
#[macro_use]
extern crate pest_derive;
Expand Down
32 changes: 24 additions & 8 deletions src/stats/bayesian/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ pub trait Posterior {
/// for an example.
#[derive(
Default,
Getters,
MutGetters,
Copy,
Clone,
Eq,
Expand All @@ -75,14 +73,8 @@ where
Po: Posterior,
Payload: Default,
{
#[get = "pub"]
#[get_mut = "pub"]
likelihood: L,
#[get = "pub"]
#[get_mut = "pub"]
prior: Pr,
#[get = "pub"]
#[get_mut = "pub"]
posterior: Po,
payload: PhantomData<Payload>,
}
Expand All @@ -106,6 +98,30 @@ where
}
}

pub fn likelihood(&self) -> &L {
&self.likelihood
}

pub fn likelihood_mut(&mut self) -> &L {
&mut self.likelihood
}

pub fn prior(&self) -> &Pr {
&self.prior
}

pub fn prior_mut(&mut self) -> &mut Pr {
&mut self.prior
}

pub fn posterior(&self) -> &Po {
&self.posterior
}

pub fn posterior_mut(&mut self) -> &mut Po {
&mut self.posterior
}

/// Calculate joint probability, i.e. `Pr(event) * Pr(data | event)`.
fn joint_prob(&self, event: &Event, data: &Data, payload: &mut Payload) -> LogProb {
self.prior.compute(event) + self.likelihood.compute(event, data, payload)
Expand Down

0 comments on commit 9eea435

Please sign in to comment.