pub struct OwningProvenanceTable { /* private fields */ }
Available on crate feature provenance only.
Expand description

A provenance table that owns its own data.

Examples

{
use tskit::provenance::OwningProvenanceTable;
let mut provenances = OwningProvenanceTable::default();
let id = provenances.add_row("message").unwrap();
assert_eq!(id, 0);
assert_eq!(provenances.num_rows(), 1);

Implementations§

Methods from Deref<Target = ProvenanceTable>§

source

pub fn num_rows(&self) -> SizeType

Return the number of rows

source

pub fn timestamp<P: Into<ProvenanceId> + Copy>(&self, row: P) -> Option<&str>

Get the ISO-formatted time stamp for row row.

Returns
  • Some(String) if row is valid.
  • None otherwise.
Examples

let mut tables = tskit::TableCollection::new(10.).unwrap();
assert!(tables.add_provenance("foo").is_ok());
if let Some(timestamp) = tables.provenances().timestamp(0) {
 // then 0 is a valid row in the provenance table
}
source

pub fn record<P: Into<ProvenanceId> + Copy>(&self, row: P) -> Option<&str>

Get the provenance record for row row.

Returns
  • Some(String) if row is valid.
  • None otherwise.
Examples

let mut tables = tskit::TableCollection::new(10.).unwrap();
assert!(tables.add_provenance("foo").is_ok());
if let Some(record) = tables.provenances().record(0) {
 // then 0 is a valid row in the provenance table
}
source

pub fn row<P: Into<ProvenanceId> + Copy>( &self, row: P ) -> Option<ProvenanceTableRow>

Obtain a ProvenanceTableRow for row row.

Returns
  • Some(row) if r is valid
  • None otherwise
source

pub fn row_view<P: Into<ProvenanceId> + Copy>( &self, row: P ) -> Option<ProvenanceTableRowView<'_>>

Obtain a ProvenanceTableRowView for row row.

Returns
  • Some(row view) if r is valid
  • None otherwise
source

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

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

source

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

Trait Implementations§

source§

impl Default for OwningProvenanceTable

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Deref for OwningProvenanceTable

§

type Target = ProvenanceTable

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for OwningProvenanceTable

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

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.