Struct tskit::provenance::OwnedProvenanceTable
source · pub struct OwnedProvenanceTable { /* private fields */ }
Available on crate feature
provenance
only.Expand description
A provenance table that owns its own data.
Examples
{
use tskit::provenance::OwnedProvenanceTable;
let mut provenances = OwnedProvenanceTable::default();
let id = provenances.add_row("message").unwrap();
assert_eq!(id, 0);
assert_eq!(provenances.num_rows(), 1);
Implementations
sourceimpl OwnedProvenanceTable
impl OwnedProvenanceTable
sourcepub fn clear(&mut self) -> TskReturnValue
pub fn clear(&mut self) -> TskReturnValue
Clear the table.
sourceimpl OwnedProvenanceTable
impl OwnedProvenanceTable
pub fn as_ptr(&self) -> *const tsk_provenance_table_t
pub fn as_mut_ptr(&mut self) -> *mut tsk_provenance_table_t
sourceimpl OwnedProvenanceTable
impl OwnedProvenanceTable
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
.
pub fn lending_iter(&self) -> ProvenanceTableRowView<'_>
Trait Implementations
sourceimpl Default for OwnedProvenanceTable
impl Default for OwnedProvenanceTable
sourceimpl Deref for OwnedProvenanceTable
impl Deref for OwnedProvenanceTable
type Target = ProvenanceTable
type Target = ProvenanceTable
The resulting type after dereferencing.
sourceimpl DerefMut for OwnedProvenanceTable
impl DerefMut for OwnedProvenanceTable
Auto Trait Implementations
impl RefUnwindSafe for OwnedProvenanceTable
impl !Send for OwnedProvenanceTable
impl !Sync for OwnedProvenanceTable
impl Unpin for OwnedProvenanceTable
impl UnwindSafe for OwnedProvenanceTable
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more