Skip to content

Commit

Permalink
feat: Make the Price type public
Browse files Browse the repository at this point in the history
  • Loading branch information
jcornaz committed Oct 15, 2022
1 parent 4ae73bc commit a3842c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/directive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::transaction::{transaction, Transaction};
pub enum Directive<'a> {
/// The [`Transaction`](crate::Transaction) directive
Transaction(Transaction<'a>),
/// The price directive
/// The [`Price`](crate::Price) directive
Price(Price<'a>),
/// The [`Open`](crate::Open) account directive
Open(Open<'a>),
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use crate::directive::directive;

pub use crate::{
account::Account, amount::Amount, date::Date, directive::Directive, error::Error, open::Open,
transaction::Transaction,
price::Price, transaction::Transaction,
};

use nom::{
Expand Down
6 changes: 6 additions & 0 deletions src/price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,26 @@ pub struct Price<'a> {
}

impl<'a> Price<'a> {
/// The date
#[must_use]
pub fn date(&self) -> Date {
self.date
}

/// The commodity for which thi price applies
#[must_use]
pub fn commodity(&self) -> &'a str {
self.commodity
}

/// The price of the commodity
#[must_use]
pub fn price(&self) -> &Amount<'a> {
&self.price
}

/// The comment, if any
#[must_use]
pub fn comment(&self) -> Option<&'a str> {
self.comment
}
Expand Down

0 comments on commit a3842c7

Please sign in to comment.