#mix #macro #traits #glissade

macro glissade-macro

Derive macro for implementing glissade::Mix trait

3 releases

0.1.2 Jul 19, 2024
0.1.1 Jun 24, 2024
0.1.0 Jun 24, 2024

#17 in #mix


Used in glissade

MIT license

6KB
114 lines

Glissade macro

Glissade macro is a Rust crate that provides Mix derive macro for the glissade library.

See the https://github.com/monkin/glissade for more information.

Usage

use glissade::Mix;

#[derive(Mix, PartialEq, Debug)]
struct Touch {
    x: f32,
    y: f32,
    pressure: u8,
}

let touch1 = Touch { x: 0.0, y: 0.0, pressure: 0 };
let touch2 = Touch { x: 100.0, y: 100.0, pressure: 200 };
let touch_mix = touch1.mix(touch2, 0.5);

assert_eq!(touch_mix, Touch { x: 50.0, y: 50.0, pressure: 100 });

License

This project is licensed under the MIT License.

Dependencies

~215–650KB
~16K SLoC