Struct tskit::NodeDefaults
source · pub struct NodeDefaults {
pub flags: NodeFlags,
pub population: PopulationId,
pub individual: IndividualId,
}
Expand description
Defaults for node table rows without metadata
Examples
let d = tskit::NodeDefaults::default();
assert_eq!(d.flags, tskit::NodeFlags::default());
assert_eq!(d.population, tskit::PopulationId::NULL);
assert_eq!(d.individual, tskit::IndividualId::NULL);
Struct update syntax is your friend here:
let d = tskit::NodeDefaults{population: 0.into(), ..Default::default()};
assert_eq!(d.flags, tskit::NodeFlags::default());
assert_eq!(d.population, 0);
assert_eq!(d.individual, tskit::IndividualId::NULL);
let d2 = tskit::NodeDefaults{flags: tskit::NodeFlags::default().mark_sample(),
// update remaining values from d
..d};
assert!(d2.flags.is_sample());
assert_eq!(d2.population, 0);
assert_eq!(d2.individual, tskit::IndividualId::NULL);
Fields§
§flags: NodeFlags
§population: PopulationId
§individual: IndividualId
Trait Implementations§
source§impl Clone for NodeDefaults
impl Clone for NodeDefaults
source§fn clone(&self) -> NodeDefaults
fn clone(&self) -> NodeDefaults
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for NodeDefaults
impl Debug for NodeDefaults
source§impl Default for NodeDefaults
impl Default for NodeDefaults
source§fn default() -> NodeDefaults
fn default() -> NodeDefaults
Returns the “default value” for a type. Read more
source§impl PartialEq<NodeDefaults> for NodeDefaults
impl PartialEq<NodeDefaults> for NodeDefaults
source§fn eq(&self, other: &NodeDefaults) -> bool
fn eq(&self, other: &NodeDefaults) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.