Struct tskit::provenance::OwningProvenanceTable
source · 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§
source§impl OwningProvenanceTable
impl OwningProvenanceTable
sourcepub fn clear(&mut self) -> TskReturnValue
pub fn clear(&mut self) -> TskReturnValue
Clear the table.
source§impl OwningProvenanceTable
impl OwningProvenanceTable
pub fn as_ptr(&self) -> *const tsk_provenance_table_t
pub fn as_mut_ptr(&mut self) -> *mut tsk_provenance_table_t
source§impl OwningProvenanceTable
impl OwningProvenanceTable
pub fn add_row(&mut self, record: &str) -> Result<ProvenanceId, TskitError>
Methods from Deref<Target = ProvenanceTable>§
sourcepub fn timestamp<P: Into<ProvenanceId> + Copy>(&self, row: P) -> Option<&str>
pub fn timestamp<P: Into<ProvenanceId> + Copy>(&self, row: P) -> Option<&str>
Get the ISO-formatted time stamp for row row
.
Returns
Some(String)
ifrow
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
}
sourcepub fn record<P: Into<ProvenanceId> + Copy>(&self, row: P) -> Option<&str>
pub fn record<P: Into<ProvenanceId> + Copy>(&self, row: P) -> Option<&str>
Get the provenance record for row row
.
Returns
Some(String)
ifrow
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
}
sourcepub fn row<P: Into<ProvenanceId> + Copy>(
&self,
row: P
) -> Option<ProvenanceTableRow>
pub fn row<P: Into<ProvenanceId> + Copy>( &self, row: P ) -> Option<ProvenanceTableRow>
sourcepub fn row_view<P: Into<ProvenanceId> + Copy>(
&self,
row: P
) -> Option<ProvenanceTableRowView<'_>>
pub fn row_view<P: Into<ProvenanceId> + Copy>( &self, row: P ) -> Option<ProvenanceTableRowView<'_>>
sourcepub fn iter(&self) -> impl Iterator<Item = ProvenanceTableRow> + '_
pub fn iter(&self) -> impl Iterator<Item = ProvenanceTableRow> + '_
Return an iterator over rows of the table.
The value of the iterator is ProvenanceTableRow
.