Skip to content

Commit

Permalink
add Stock::merge_articles method
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Dec 15, 2024
1 parent 1020831 commit 8d56c30
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/stock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ impl<S: Supply<CAPS>, const CAPS: u32> Stock<S, CAPS> {
Ok(())
}

pub fn merge_articles(&mut self, articles: Articles<CAPS>) -> Result<(), MergeError> {
self.articles.merge(articles)?;
self.supply.save_articles(&self.articles);
Ok(())
}

pub fn import(&mut self, reader: &mut StrictReader<impl ReadRaw>) -> Result<(), AcceptError> {
let articles = Articles::<CAPS>::strict_decode(reader)?;
self.articles.merge(articles)?;
Expand Down

0 comments on commit 8d56c30

Please sign in to comment.