Struct tskit::MigrationTable
source · #[repr(transparent)]pub struct MigrationTable { /* private fields */ }
Expand description
An immutable view of a migration table.
Implementations§
source§impl MigrationTable
impl MigrationTable
sourcepub fn right<M: Into<MigrationId> + Copy>(&self, row: M) -> Option<Position>
pub fn right<M: Into<MigrationId> + Copy>(&self, row: M) -> Option<Position>
Return the right coordinate for a given row.
Returns
Some(positions)
ifrow
is valid.None
otherwise.
sourcepub fn source<M: Into<MigrationId> + Copy>(
&self,
row: M
) -> Option<PopulationId>
pub fn source<M: Into<MigrationId> + Copy>( &self, row: M ) -> Option<PopulationId>
Return the source population for a given row.
Returns
Some(population)
ifrow
is valid.None
otherwise.
sourcepub fn dest<M: Into<MigrationId> + Copy>(&self, row: M) -> Option<PopulationId>
pub fn dest<M: Into<MigrationId> + Copy>(&self, row: M) -> Option<PopulationId>
Return the destination population for a given row.
Returns
Some(population)
ifrow
is valid.None
otherwise.
sourcepub fn time<M: Into<MigrationId> + Copy>(&self, row: M) -> Option<Time>
pub fn time<M: Into<MigrationId> + Copy>(&self, row: M) -> Option<Time>
Return the time of the migration event for a given row.
Returns
Some(time)
ifrow
is valid.None
otherwise.
sourcepub fn metadata<T: MigrationMetadata>(
&self,
row: MigrationId
) -> Option<Result<T, TskitError>>
pub fn metadata<T: MigrationMetadata>( &self, row: MigrationId ) -> 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 = MigrationTableRow> + '_
pub fn iter(&self) -> impl Iterator<Item = MigrationTableRow> + '_
Return an iterator over rows of the table.
The value of the iterator is MigrationTableRow
.
pub fn lending_iter(&self) -> MigrationTableRowView<'_>
sourcepub fn row<M: Into<MigrationId> + Copy>(
&self,
r: M
) -> Option<MigrationTableRow>
pub fn row<M: Into<MigrationId> + Copy>( &self, r: M ) -> Option<MigrationTableRow>
sourcepub fn row_view<M: Into<MigrationId> + Copy>(
&self,
r: M
) -> Option<MigrationTableRowView<'_>>
pub fn row_view<M: Into<MigrationId> + Copy>( &self, r: M ) -> Option<MigrationTableRowView<'_>>
Return a view of r
of the table.
Parameters
r
: the row id.
Returns
Some(row view)
ifr
is validNone
otherwise
sourcepub fn left_slice(&self) -> &[Position]
pub fn left_slice(&self) -> &[Position]
Get the left column as a slice
sourcepub fn left_slice_raw(&self) -> &[f64]
pub fn left_slice_raw(&self) -> &[f64]
Get the left column as a slice
sourcepub fn right_slice(&self) -> &[Position]
pub fn right_slice(&self) -> &[Position]
Get the right column as a slice
sourcepub fn right_slice_raw(&self) -> &[f64]
pub fn right_slice_raw(&self) -> &[f64]
Get the right column as a slice
sourcepub fn time_slice(&self) -> &[Time]
pub fn time_slice(&self) -> &[Time]
Get the time column as a slice
sourcepub fn time_slice_raw(&self) -> &[f64]
pub fn time_slice_raw(&self) -> &[f64]
Get the time column as a slice
sourcepub fn node_slice(&self) -> &[NodeId]
pub fn node_slice(&self) -> &[NodeId]
Get the node column as a slice
sourcepub fn node_slice_raw(&self) -> &[tsk_id_t]
pub fn node_slice_raw(&self) -> &[tsk_id_t]
Get the node column as a slice
sourcepub fn source_slice(&self) -> &[PopulationId]
pub fn source_slice(&self) -> &[PopulationId]
Get the source column as a slice
sourcepub fn source_slice_raw(&self) -> &[tsk_id_t]
pub fn source_slice_raw(&self) -> &[tsk_id_t]
Get the source column as a slice
sourcepub fn dest_slice(&self) -> &[PopulationId]
pub fn dest_slice(&self) -> &[PopulationId]
Get the dest column as a slice
sourcepub fn dest_slice_raw(&self) -> &[tsk_id_t]
pub fn dest_slice_raw(&self) -> &[tsk_id_t]
Get the dest column as a slice