rust-payjoin icon indicating copy to clipboard operation
rust-payjoin copied to clipboard

Introduce Payjoin version enum

Open shinghim opened this issue 8 months ago • 3 comments

Fixes #643

shinghim avatar Apr 25 '25 15:04 shinghim

Pull Request Test Coverage Report for Build 14868573150

Details

  • 20 of 28 (71.43%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 81.995%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin/src/core/version.rs 0 8 0.0%
<!-- Total: 20 28
Totals Coverage Status
Change from base Build 14867604163: -0.03%
Covered Lines: 5442
Relevant Lines: 6637

💛 - Coveralls

coveralls avatar Apr 25 '25 15:04 coveralls

have you considered an explicit discriminant enum? I can't imagine our Version enum would ever have fields unless we did something wonky to have sub-versions.

Something like the following is what I was thinking about. I'm not suggesting a change per se but trying to understand the rationale for one over the other if there was one

#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Version {
    One = 1,
    Two = 2,
}

DanGould avatar Apr 25 '25 16:04 DanGould

@DanGould I hadn't considered it, but I think it makes more sense to have it as an explicit discriminant enum so we don't need the extra logic to convert to a usize. I'm not too familiar with the #[repr(u8)] bit but did some reading, and it looks like it'll be necessary since it might get included in the ffi work

shinghim avatar Apr 26 '25 13:04 shinghim

Also moved Version into the new core module

shinghim avatar May 01 '25 04:05 shinghim