Skip to content

Commit 6d51442

Browse files
committed
update to provenance trait
1 parent 9af587a commit 6d51442

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/provenance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub trait Provenance: crate::TableAccess {
100100
/// # Parameters
101101
///
102102
/// * `record`: the provenance record
103-
fn add_provenance(&mut self, record: &str) -> crate::TskReturnValue;
103+
fn add_provenance(&mut self, record: &str) -> Result<ProvenanceId, TskitError>;
104104
/// Return an immutable reference to the table, type [`ProvenanceTable`]
105105
fn provenances(&self) -> ProvenanceTable;
106106
/// Return an iterator over the rows of the [`ProvenanceTable`].

src/table_collection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ impl crate::traits::NodeListGenerator for TableCollection {}
633633

634634
#[cfg(any(doc, feature = "provenance"))]
635635
impl crate::provenance::Provenance for TableCollection {
636-
fn add_provenance(&mut self, record: &str) -> TskReturnValue {
636+
fn add_provenance(&mut self, record: &str) -> Result<crate::ProvenanceId, TskitError> {
637637
if record.is_empty() {
638638
return Err(TskitError::ValueError {
639639
got: String::from("empty string slice"),
@@ -650,7 +650,7 @@ impl crate::provenance::Provenance for TableCollection {
650650
record.len() as tsk_size_t,
651651
)
652652
};
653-
handle_tsk_return_value!(rv)
653+
handle_tsk_return_value!(rv, crate::ProvenanceId::from(rv))
654654
}
655655

656656
fn provenances(&self) -> crate::provenance::ProvenanceTable {

src/trees.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ impl crate::traits::NodeListGenerator for TreeSequence {}
11351135

11361136
#[cfg(any(doc, feature = "provenance"))]
11371137
impl crate::provenance::Provenance for TreeSequence {
1138-
fn add_provenance(&mut self, record: &str) -> TskReturnValue {
1138+
fn add_provenance(&mut self, record: &str) -> Result<crate::ProvenanceId, TskitError> {
11391139
if record.is_empty() {
11401140
return Err(TskitError::ValueError {
11411141
got: String::from("empty string slice"),
@@ -1152,7 +1152,7 @@ impl crate::provenance::Provenance for TreeSequence {
11521152
record.len() as tsk_size_t,
11531153
)
11541154
};
1155-
handle_tsk_return_value!(rv)
1155+
handle_tsk_return_value!(rv, crate::ProvenanceId::from(rv))
11561156
}
11571157

11581158
fn provenances(&self) -> crate::provenance::ProvenanceTable {

0 commit comments

Comments
 (0)