no need to construct stats

This commit is contained in:
2026-05-17 10:07:43 -07:00
parent 595ff73f90
commit d33d75870b
+4 -10
View File
@@ -238,18 +238,12 @@ pub enum SessionInstruction<I> {
InnerInstruction(I), InnerInstruction(I),
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug, Default)]
pub struct SessionStats<S> { pub struct SessionStats<S> {
inner_stats: S, inner_stats: S,
undos: usize, undos: usize,
} }
impl<S> SessionStats<S> { impl<S> SessionStats<S> {
const fn new(inner_stats: S) -> Self {
SessionStats {
inner_stats,
undos: 0,
}
}
pub const fn stats(&self) -> &S { pub const fn stats(&self) -> &S {
&self.inner_stats &self.inner_stats
} }
@@ -287,9 +281,9 @@ where
G::Stats: Clone + Default, G::Stats: Clone + Default,
G::Instruction: Clone + Eq + core::hash::Hash, G::Instruction: Clone + Eq + core::hash::Hash,
{ {
pub fn new(state: G, stats: G::Stats, config: G::Config) -> Self { pub fn new(state: G, config: G::Config) -> Self {
Self { Self {
stats: SessionStats::new(stats), stats: SessionStats::default(),
config, config,
state: SessionState::new(state), state: SessionState::new(state),
} }
@@ -298,7 +292,7 @@ where
where where
G::Config: Default, G::Config: Default,
{ {
Self::new(state, Default::default(), Default::default()) Self::new(state, Default::default())
} }
pub const fn stats(&self) -> &SessionStats<G::Stats> { pub const fn stats(&self) -> &SessionStats<G::Stats> {
&self.stats &self.stats