Add type for raw price specs
Dependencies
- [2]
UO34MAAGRefactor CSV-based Importers - [3]
OILXIR24Support metadata on postings - [4]
NG5QXPZHExtract Account into separate crate - [5]
XQHYMSDYAdd importer for Union Investment transactions - [6]
QRIJE4AQadd a simple pretty printer for beancount directives - [7]
SJ6AFVZLremove const configuration in favor of runtime config - [8]
XWHISGCPExtract Amount into separate crate - [9]
T2S6UAVJInclude builder methods on beancount-types - [10]
WS3UUOV3Extract commodity type into separate crate - [11]
PCHAKXNMAdd an importer for Fidor account statements - [12]
BDLVPDJZAdd a importer account for BW bank portfolios - [13]
YDK6X6PPadd a library of important types for beancount - [*]
2JBFREZGenable additional warnings - [*]
I2P2FTLEadd basic parser for german decimals - [*]
SLTVZLYXUpgrade dependencies - [*]
D6UTHZA4add a simple writer for saving a set of directives to a tree of files
Change contents
- edit in importers/uniondepot/src/lib.rs at line 16
use beancount_types::PriceSpec; - replacement in importers/uniondepot/src/lib.rs at line 231
posting.price = price;posting.price = price.map(PriceSpec::from); - edit in importers/bw-bank/src/portfolio.rs at line 15
use beancount_types::PriceSpec; - replacement in importers/bw-bank/src/portfolio.rs at line 176
posting.price = price;posting.price = price.map(PriceSpec::from); - edit in common/beancount-types/src/transaction.rs at line 7
use beancount_price_spec::PriceSpec; - replacement in common/beancount-types/src/transaction.rs at line 33
pub price: Option<Amount>,pub price: Option<PriceSpec>, - replacement in common/beancount-types/src/transaction.rs at line 136
pub fn set_price(&mut self, price: Amount) -> &mut Self {self.price = Some(price);pub fn set_price(&mut self, price: impl Into<PriceSpec>) -> &mut Self {self.price = Some(price.into()); - replacement in common/beancount-types/src/transaction.rs at line 166
write!(f, " @ {price}")?;write!(f, " {price}")?; - edit in common/beancount-types/src/lib.rs at line 11
pub use beancount_price_spec::PriceSpec; - replacement in common/beancount-types/Cargo.toml at line 27[4.2285]→[4.1800:1853](∅→∅),[4.1853]→[4.1919:1971](∅→∅),[4.1971]→[4.1853:1908](∅→∅),[4.1853]→[4.1853:1908](∅→∅)
beancount-account.path = "../../beancount/account"beancount-amount.path = "../../beancount/amount"beancount-commodity.path = "../../beancount/commodity"beancount-account.path = "../../beancount/account"beancount-amount.path = "../../beancount/amount"beancount-commodity.path = "../../beancount/commodity"beancount-price-spec.path = "../../beancount/price-spec" - replacement in common/beancount-pretty-printer/src/lib.rs at line 301
write!(self.inner, " @ {price}")?;write!(self.inner, " {price}")?; - file addition: price-spec[4.1]
- file addition: src[0.759]
- file addition: lib.rs[0.776]
use core::fmt::Display;use beancount_amount::Amount;#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]pub enum PriceSpec {PerUnit(Amount),Total(Amount),}impl PriceSpec {pub const fn amount(&self) -> Amount {let (Self::PerUnit(amount) | Self::Total(amount)) = self;*amount}}impl Display for PriceSpec {fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {let symbol = match self {Self::PerUnit(_) => "@",Self::Total(_) => "@@",};let amount = self.amount();write!(f, "{symbol} {amount}")}}impl From<Amount> for PriceSpec {fn from(amount: Amount) -> Self {Self::PerUnit(amount)}} - file addition: Cargo.toml[0.759]
[package]name = "beancount-price-spec"authors.workspace = trueedition.workspace = truepublish.workspace = truerust-version.workspace = trueversion.workspace = true[dependencies]# Workspace dependenciesbeancount-amount.path = "../amount" - edit in Cargo.lock at line 133
"hashbrown 0.14.3", - edit in Cargo.lock at line 357[18.5692][18.5692]
name = "beancount-price-spec"version = "0.0.0-dev.0"dependencies = ["beancount-amount",][[package]] - edit in Cargo.lock at line 389
"beancount-price-spec",