as_tuple

Crates.ioas_tuple
lib.rsas_tuple
version0.1.0
sourcesrc
created_at2019-01-05 01:46:41.774554
updated_at2019-01-05 01:46:41.774554
descriptionView any struct as a tuple! ✨
homepage
repositoryhttps://github.com/francesca64/as_tuple
max_upload_size
id105570
size4,906
Francesca Lovebloom (francesca64)

documentation

https://docs.rs/as_tuple

README

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)

Commit count: 1

cargo fmt