#[repr(transparent)]pub struct SiteTable { /* private fields */ }
Expand description
An immutable view of site table.
Implementations§
source§impl SiteTable
impl SiteTable
sourcepub fn position<S: Into<SiteId> + Copy>(&self, row: S) -> Option<Position>
pub fn position<S: Into<SiteId> + Copy>(&self, row: S) -> Option<Position>
Return the position
value from row row
of the table.
Returns
Some(position)
ifrow
is valid.None
otherwise.
sourcepub fn ancestral_state<S: Into<SiteId>>(&self, row: S) -> Option<&[u8]>
pub fn ancestral_state<S: Into<SiteId>>(&self, row: S) -> Option<&[u8]>
Get the ancestral_state
value from row row
of the table.
Returns
Some(ancestral state)
ifrow
is valid.None
otherwise.
sourcepub fn metadata<T: SiteMetadata>(
&self,
row: SiteId
) -> Option<Result<T, TskitError>>
pub fn metadata<T: SiteMetadata>( &self, row: SiteId ) -> 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 = SiteTableRow> + '_
pub fn iter(&self) -> impl Iterator<Item = SiteTableRow> + '_
Return an iterator over rows of the table.
The value of the iterator is SiteTableRow
.
pub fn lending_iter(&self) -> SiteTableRowView<'_>
sourcepub fn row_view<S: Into<SiteId> + Copy>(
&self,
r: S
) -> Option<SiteTableRowView<'_>>
pub fn row_view<S: Into<SiteId> + Copy>( &self, r: S ) -> Option<SiteTableRowView<'_>>
Return a view of row r
of the table.
Parameters
r
: the row id.
Returns
Some(row view)
ifr
is validNone
otherwise
sourcepub fn position_slice(&self) -> &[Position]
pub fn position_slice(&self) -> &[Position]
Get the position column as a slice
sourcepub fn position_slice_raw(&self) -> &[f64]
pub fn position_slice_raw(&self) -> &[f64]
Get the position column as a slice