opdater 0.1.1

Small trait based approch to struct updates
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented2 out of 3 items with examples
  • Size
  • Source code size: 5.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.12 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Erk-

Opdater

Small trait based approch to implement updating of structs.

The main goal of this crate is to allow updating a struct continously without writing a lot of boilerplate code.

Example

use opdater::Opdater;

#[derive(Debug, PartialEq, Opdater)]
struct Bla {
    a: Option<i32>,
    b: Option<f32>,
}

let mut bla = Bla { a: None, b: None };
let bla_op = Bla {
    a: Some(10),
    b: Some(13.37),
};

bla.update(bla_op);

assert_eq!(
    bla,
    Bla {
        a: Some(10),
        b: Some(13.37)
    }
);

let bla_op2 = Bla {
    a: Some(5),
    b: None,
};

bla.update(bla_op2);

assert_eq!(
    bla,
    Bla {
        a: Some(5),
        b: Some(13.37)
    }
);

Etmylogy

Opdater means to update in Danish.

License

This is licensed under the ISC License