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 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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SiteTable
impl RefUnwindSafe for SiteTable
impl !Send for SiteTable
impl !Sync for SiteTable
impl Unpin for SiteTable
impl UnwindSafe for SiteTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more