We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77ae8a9 commit 541f516Copy full SHA for 541f516
src/_macros.rs
@@ -173,6 +173,12 @@ macro_rules! impl_id_traits {
173
self.partial_cmp(&other.0)
174
}
175
176
+
177
+ impl Default for $idtype {
178
+ fn default() -> Self {
179
+ Self::NULL
180
+ }
181
182
};
183
184
src/newtypes.rs
@@ -17,6 +17,9 @@ use bindings::tsk_size_t;
17
/// use tskit::NodeId;
18
/// use tskit::bindings::tsk_id_t;
19
///
20
+/// // The default value is null:
21
+/// assert_eq!(tskit::NodeId::default(), tskit::NodeId::NULL);
22
+///
23
/// let x: tsk_id_t = 1;
24
/// let y: NodeId = NodeId::from(x);
25
/// assert_eq!(x, y);
0 commit comments