Move linking logic from uniondepot importer to runner

korrat
Jun 26, 2023, 2:00 PM
WCCQYDLPFFKADXKADXV7IR2DCY4RKNXHIFNBKXJRTIRLL5YTH52QC

Dependencies

  • [2] XQHYMSDY Add importer for Union Investment transactions
  • [3] YBARPI2B Make account templates owned
  • [4] 5S4MZHL5 pretty print decimals using icu
  • [5] 2JBFREZG enable additional warnings
  • [6] R7S2CWF7 Add type for account segments
  • [7] YDK6X6PP add a library of important types for beancount
  • [*] I2P2FTLE add basic parser for german decimals

Change contents

  • edit in importers/uniondepot/src/lib.rs at line 4
    [2.108][2.108:130]()
    use core::hash::Hash;
  • edit in importers/uniondepot/src/lib.rs at line 16
    [2.532][2.532:559]()
    use beancount_types::Link;
  • edit in importers/uniondepot/src/lib.rs at line 27
    [2.863][2.863:893]()
    use xxhash_rust::xxh3::Xxh3;
  • edit in importers/uniondepot/src/lib.rs at line 256
    [2.7782][2.7782:8065]()
    TransactionKind::Purchase | TransactionKind::Sale
    ) {
    transaction.add_link(
    Link::try_from(format!("^union-investment.{:X}", hash(date, &context))).unwrap(),
    );
    }
    if matches!(
    transaction_kind,
  • edit in importers/uniondepot/src/lib.rs at line 455
    [2.13632][2.13632:13835]()
    }
    fn hash(date: Date, context: &TemplateContext) -> u128 {
    let mut hasher = Xxh3::new();
    (context.depot, context.position, date.year(), date.month()).hash(&mut hasher);
    hasher.digest128()
  • edit in importers/uniondepot/Cargo.toml at line 23
    [2.14517][2.14517:14549]()
    xxhash-rust.workspace = true
  • edit in beancount/account/src/lib.rs at line 1
    [3.11466]
    [3.13655]
    #![warn(clippy::all, clippy::nursery, clippy::pedantic)]
  • replacement in beancount/account/src/lib.rs at line 48
    [3.11957][3.14604:14664](),[3.14664][3.11957:12062](),[3.11957][3.11957:12062]()
    /// Produces an iterator over the segments of the path.
    pub fn segments(&self) -> Segments<'_> {
    Segments {
    inner: self.name.split(':'),
    [3.11957]
    [3.12062]
    /// Returns the final segment of the account name.
    #[must_use]
    pub fn leaf_name(&self) -> &Seg {
    let leaf = self
    .name
    .rsplit_once(':')
    .map_or(&self.name, |(_, leaf)| leaf);
    unsafe {
    // SAFETY: By construction, if `self` is a valid account name, `leaf` is a valid account segment.
    Seg::from_unchecked(leaf)
  • replacement in beancount/account/src/lib.rs at line 65
    [3.12123][3.14759:14813]()
    self.name.split_once(':').map(|(parent, _)| {
    [3.12123]
    [3.14813]
    self.name.rsplit_once(':').map(|(parent, _)| {
  • edit in beancount/account/src/lib.rs at line 72
    [3.15061]
    [3.12242]
    }
    /// Produces an iterator over the segments of the path.
    pub fn segments(&self) -> Segments<'_> {
    Segments {
    inner: self.name.split(':'),
    }
  • edit in beancount/account/src/lib.rs at line 80
    [3.12248]
    [3.12248]
    }
  • edit in beancount/account/src/lib.rs at line 82
    [3.12249]
    [3.15062]
    impl Acc {
  • replacement in beancount/account/src/lib.rs at line 155
    [3.12841][3.15756:15786]()
    self.name.hash(state)
    [3.12841]
    [3.12872]
    self.name.hash(state);
  • replacement in beancount/account/src/lib.rs at line 292
    [3.15927][3.15927:16037]()
    impl PartialOrd<Cow<'_, Acc>> for Acc {
    fn partial_cmp(&self, other: &Cow<'_, Acc>) -> Option<Ordering> {
    [3.15927]
    [3.16037]
    impl PartialOrd<Cow<'_, Self>> for Acc {
    fn partial_cmp(&self, other: &Cow<'_, Self>) -> Option<Ordering> {
  • replacement in beancount/account/src/lib.rs at line 420
    [3.525][3.525:559]()
    impl From<&Account> for Account {
    [3.525]
    [3.559]
    impl From<&Self> for Account {
  • replacement in beancount/account/src/lib.rs at line 422
    [3.573][3.573:612]()
    fn from(value: &Account) -> Self {
    [3.573]
    [3.612]
    fn from(value: &Self) -> Self {
  • replacement in beancount/account/src/lib.rs at line 439
    [3.16324][3.18917:18946](),[3.18917][3.18917:18946]()
    (**self).hash(state)
    [3.16324]
    [3.18946]
    (**self).hash(state);
  • edit in Cargo.lock at line 4324
    [2.15573][2.15573:15589]()
    "xxhash-rust",