https://github.com/francesca64/as_tuple
View any struct as a tuple! ✨
https://github.com/francesca64/as_tuple
derive macros rust tuple
Last synced: 12 months ago
JSON representation
View any struct as a tuple! ✨
- Host: GitHub
- URL: https://github.com/francesca64/as_tuple
- Owner: francesca64
- License: apache-2.0
- Created: 2019-01-05T01:09:48.000Z (about 7 years ago)
- Default Branch: mistress
- Last Pushed: 2019-01-05T01:44:45.000Z (about 7 years ago)
- Last Synced: 2025-03-22T17:13:20.910Z (about 1 year ago)
- Topics: derive, macros, rust, tuple
- Language: Rust
- Size: 8.79 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# `as_tuple`
View any struct as a tuple! ✨
[](https://crates.io/crates/as_tuple)
[](https://docs.rs/as_tuple)
[](https://travis-ci.org/francesca64/as_tuple)
```toml
[dependencies]
as_tuple = "0.1"
```
```rust
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`)