Struct tskit::SiteTable

source ·
#[repr(transparent)]
pub struct SiteTable { /* private fields */ }
Expand description

An immutable view of site table.

Implementations§

source§

impl SiteTable

source

pub fn num_rows(&self) -> SizeType

Return the number of rows

source

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) if row is valid.
  • None otherwise.
source

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) if row is valid.
  • None otherwise.
source

pub fn metadata<T: SiteMetadata>( &self, row: SiteId ) -> Option<Result<T, TskitError>>

Retrieve decoded metadata for a row.

Returns
  • Some(Ok(T)) if row is valid and decoding succeeded.
  • Some(Err(_)) if row is not valid and decoding failed.
  • None if row is not valid.
Errors
Examples.

The big-picture semantics are the same for all table types. See crate::IndividualTable::metadata for examples.

source

pub fn iter(&self) -> impl Iterator<Item = SiteTableRow> + '_

Return an iterator over rows of the table. The value of the iterator is SiteTableRow.

source

pub fn lending_iter(&self) -> SiteTableRowView<'_>

source

pub fn row<S: Into<SiteId> + Copy>(&self, r: S) -> Option<SiteTableRow>

Return row r of the table.

Parameters
  • r: the row id.
Returns
  • Some(row) if r is valid
  • None otherwise
source

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) if r is valid
  • None otherwise
source

pub fn position_slice(&self) -> &[Position]

Get the position column as a slice

source

pub fn position_slice_raw(&self) -> &[f64]

Get the position column as a slice

Trait Implementations§

source§

impl Debug for SiteTable

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Free for T

source§

unsafe default fn free(ptr_ref: NonNull<T>)

Drops the content pointed by this pointer and frees it. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.