Skip to content

Commit 258b4ee

Browse files
authored
replace IdIsNull trait with associated fn (#156)
1 parent 9987fc0 commit 258b4ee

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

src/_macros.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ macro_rules! impl_id_traits {
259259
impl $idtype {
260260
/// NULL value for this type.
261261
pub const NULL: $idtype = Self($crate::TSK_NULL);
262+
263+
/// Return `true` is `self == Self::NULL`
264+
pub fn is_null(&self) -> bool {
265+
*self == Self::NULL
266+
}
262267
}
263268

264269
impl From<$crate::tsk_id_t> for $idtype {
@@ -267,12 +272,6 @@ macro_rules! impl_id_traits {
267272
}
268273
}
269274

270-
impl $crate::IdIsNull for $idtype {
271-
fn is_null(&self) -> bool {
272-
self.0 == Self::NULL
273-
}
274-
}
275-
276275
impl From<$idtype> for usize {
277276
fn from(value: $idtype) -> Self {
278277
value.0 as usize

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ pub use node_table::{NodeTable, NodeTableRow};
220220
pub use population_table::{PopulationTable, PopulationTableRow};
221221
pub use site_table::{SiteTable, SiteTableRow};
222222
pub use table_collection::TableCollection;
223-
pub use traits::IdIsNull;
224223
pub use traits::NodeListGenerator;
225224
pub use traits::TableAccess;
226225
pub use traits::TskitTypeAccess;

src/test_simplification.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
mod tests {
33
use crate::test_fixtures::make_small_table_collection_two_trees;
44
use crate::test_fixtures::treeseq_from_small_table_collection_two_trees;
5-
use crate::IdIsNull;
65
use crate::NodeId;
76
use crate::SimplificationOptions;
87
use crate::TableAccess;

src/traits.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,3 @@ pub trait NodeListGenerator: TableAccess {
200200
self.nodes().create_node_id_vector(f)
201201
}
202202
}
203-
204-
pub trait IdIsNull {
205-
fn is_null(&self) -> bool;
206-
}

0 commit comments

Comments
 (0)