Skip to content

Commit a4c3bd2

Browse files
committed
Fix some derive trait issues on EnvOpenOptions
1 parent 8f6db07 commit a4c3bd2

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

heed/src/envs/env_open_options.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::txn::{TlsUsage, WithoutTls};
2626
use crate::{EnvFlags, Error, Result, WithTls};
2727

2828
/// Options and flags which can be used to configure how an environment is opened.
29-
#[derive(Clone, Debug, PartialEq, Eq)]
29+
#[derive(Debug, PartialEq, Eq)]
3030
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3131
pub struct EnvOpenOptions<T: TlsUsage> {
3232
map_size: Option<usize>,
@@ -36,12 +36,6 @@ pub struct EnvOpenOptions<T: TlsUsage> {
3636
_tls_marker: PhantomData<T>,
3737
}
3838

39-
impl Default for EnvOpenOptions<WithTls> {
40-
fn default() -> Self {
41-
Self::new()
42-
}
43-
}
44-
4539
impl EnvOpenOptions<WithTls> {
4640
/// Creates a blank new set of options ready for configuration.
4741
pub fn new() -> EnvOpenOptions<WithTls> {
@@ -136,9 +130,6 @@ impl<T: TlsUsage> EnvOpenOptions<T> {
136130
let Self { map_size, max_readers, max_dbs, flags, _tls_marker: _ } = self;
137131
EnvOpenOptions { map_size, max_readers, max_dbs, flags, _tls_marker: PhantomData }
138132
}
139-
}
140-
141-
impl<T: TlsUsage> EnvOpenOptions<T> {
142133
/// Set the size of the memory map to use for this environment.
143134
///
144135
/// It must be a multiple of the OS page size.
@@ -494,3 +485,16 @@ impl<T: TlsUsage> EnvOpenOptions<T> {
494485
}
495486
}
496487
}
488+
489+
impl Default for EnvOpenOptions<WithTls> {
490+
fn default() -> Self {
491+
Self::new()
492+
}
493+
}
494+
495+
impl<T: TlsUsage> Clone for EnvOpenOptions<T> {
496+
fn clone(&self) -> Self {
497+
let Self { map_size, max_readers, max_dbs, flags, _tls_marker } = *self;
498+
EnvOpenOptions { map_size, max_readers, max_dbs, flags, _tls_marker }
499+
}
500+
}

heed/src/txn.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ impl<T> Drop for RoTxn<'_, T> {
124124
/// at a time, plus any child (nested) transactions. Each transaction belongs
125125
/// to one thread. A `BadRslot` error will be thrown when multiple read
126126
/// transactions exists on the same thread.
127+
#[derive(Debug, PartialEq, Eq)]
127128
pub enum WithTls {}
128129

129130
/// Parameter defining that read transactions are opened without
@@ -132,6 +133,7 @@ pub enum WithTls {}
132133
/// When used to open transactions: A thread can use any number
133134
/// of read transactions at a time on the same thread. Read transactions
134135
/// can be moved in between threads (`Send`).
136+
#[derive(Debug, PartialEq, Eq)]
135137
pub enum WithoutTls {}
136138

137139
/// Specifycies if Thread Local Storage (TLS) must be used when

0 commit comments

Comments
 (0)