Struct tskit::PopulationTable
source · #[repr(transparent)]pub struct PopulationTable { /* private fields */ }
Expand description
An immutable view of site table.
Implementations§
source§impl PopulationTable
impl PopulationTable
sourcepub fn metadata<T: PopulationMetadata>(
&self,
row: PopulationId
) -> Option<Result<T, TskitError>>
pub fn metadata<T: PopulationMetadata>( &self, row: PopulationId ) -> Option<Result<T, TskitError>>
Retrieve decoded metadata for a row
.
Returns
Some(Ok(T))
ifrow
is valid and decoding succeeded.Some(Err(_))
ifrow
is not valid and decoding failed.None
ifrow
is not valid.
Errors
TskitError::MetadataError
if decoding fails.
Examples.
The big-picture semantics are the same for all table types.
See crate::IndividualTable::metadata
for examples.
sourcepub fn iter(&self) -> impl Iterator<Item = PopulationTableRow> + '_
pub fn iter(&self) -> impl Iterator<Item = PopulationTableRow> + '_
Return an iterator over rows of the table.
The value of the iterator is PopulationTableRow
.
pub fn lending_iter(&self) -> PopulationTableRowView<'_>
sourcepub fn row<P: Into<PopulationId> + Copy>(
&self,
r: P
) -> Option<PopulationTableRow>
pub fn row<P: Into<PopulationId> + Copy>( &self, r: P ) -> Option<PopulationTableRow>
sourcepub fn row_view<P: Into<PopulationId> + Copy>(
&self,
r: P
) -> Option<PopulationTableRowView<'_>>
pub fn row_view<P: Into<PopulationId> + Copy>( &self, r: P ) -> Option<PopulationTableRowView<'_>>
Return a view of row r
of the table.
Parameters
r
: the row id.
Returns
Some(row view)
ifr
is validNone
otherwise