as_tuple 0.1.0

View any struct as a tuple! ✨
Documentation
  • Coverage
  • 85.71%
    6 out of 7 items documented1 out of 3 items with examples
  • Size
  • Source code size: 5.72 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: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • francesca64/as_tuple
    3 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • francesca64

as_tuple

View any struct as a tuple! ✨

crates.io badge docs.rs badge Travis badge

[dependencies]
as_tuple = "0.1"
use as_tuple::AsTuple;

#[derive(AsTuple, Debug)]
struct Position {
    x: f32,
    y: f32,
}

let mut position = Position { x: 6.2, y: 4.3 };
let (x, y) = position.as_tuple_mut();
*x -= 1.0;
*y += 1.0;
println!("{:#?}", position);

(You can try it with cargo run --example position)