pub struct NodeTable<'a> { /* private fields */ }
Expand description
An immtable view of a node table.
These are not created directly.
Instead, use TableCollection::nodes
to get a reference to an existing node table;
Implementations
sourceimpl<'a> NodeTable<'a>
impl<'a> NodeTable<'a>
sourcepub fn time<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<Time, TskitError>
pub fn time<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<Time, TskitError>
Return the time
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn flags<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<NodeFlags, TskitError>
pub fn flags<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<NodeFlags, TskitError>
Return the flags
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn flags_array_mut(&mut self) -> &mut [NodeFlags]
pub fn flags_array_mut(&mut self) -> &mut [NodeFlags]
Mutable access to node flags.
sourcepub fn time_array_mut(&mut self) -> &mut [Time]
pub fn time_array_mut(&mut self) -> &mut [Time]
Mutable access to node times.
sourcepub fn population<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<PopulationId, TskitError>
pub fn population<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<PopulationId, TskitError>
Return the population
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn deme<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<PopulationId, TskitError>
pub fn deme<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<PopulationId, TskitError>
Return the population
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
sourcepub fn individual<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<IndividualId, TskitError>
pub fn individual<N: Into<NodeId> + Copy>(
&'a self,
row: N
) -> Result<IndividualId, TskitError>
Return the individual
value from row row
of the table.
Errors
Will return IndexError
if row
is out of range.
pub fn metadata<T: MetadataRoundtrip>(
&'a self,
row: NodeId
) -> Result<Option<T>, TskitError>
sourcepub fn iter(&self) -> impl Iterator<Item = NodeTableRow> + '_
pub fn iter(&self) -> impl Iterator<Item = NodeTableRow> + '_
Return an iterator over rows of the table.
The value of the iterator is NodeTableRow
.
sourcepub fn row<N: Into<NodeId> + Copy>(
&self,
r: N
) -> Result<NodeTableRow, TskitError>
pub fn row<N: Into<NodeId> + Copy>(
&self,
r: N
) -> Result<NodeTableRow, TskitError>
Return row r
of the table.
Parameters
r
: the row id.
Errors
TskitError::IndexError
if r
is out of range.
sourcepub fn samples_as_vector(&self) -> Vec<NodeId>
pub fn samples_as_vector(&self) -> Vec<NodeId>
Obtain a vector containing the indexes (“ids”)
of all nodes for which crate::TSK_NODE_IS_SAMPLE
is true
.
sourcepub fn create_node_id_vector(
&self,
f: impl FnMut(&NodeTableRow) -> bool
) -> Vec<NodeId>
pub fn create_node_id_vector(
&self,
f: impl FnMut(&NodeTableRow) -> bool
) -> Vec<NodeId>
Obtain a vector containing the indexes (“ids”) of all nodes satisfying a certain criterion.
Auto Trait Implementations
impl<'a> RefUnwindSafe for NodeTable<'a>
impl<'a> !Send for NodeTable<'a>
impl<'a> !Sync for NodeTable<'a>
impl<'a> Unpin for NodeTable<'a>
impl<'a> UnwindSafe for NodeTable<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more