Commit 1495a8aa authored by Luke Jones's avatar Luke Jones

Add extra ops

parent 36a59634
Pipeline #62912671 passed with stages
in 3 minutes and 44 seconds
[package]
name = "vec2d"
version = "0.2.0"
version = "0.3.2"
authors = ["Luke Jones <luke@sphereidentity.com>"]
edition = "2018"
......
......@@ -9,8 +9,8 @@ use std::ops::{
/// Representation of a mathematical vector e.g. a position or velocity
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, Default)]
pub struct Vec2d<T> {
x: T,
y: T,
pub x: T,
pub y: T,
}
macro_rules! impl_vec_ops_for {
......@@ -51,23 +51,9 @@ macro_rules! impl_vec_ops_for {
}
#[inline]
pub fn get_x(&self) -> $t {
self.x
}
#[inline]
pub fn get_y(&self) -> $t {
self.y
}
#[inline]
pub fn set_x(&mut self, x: $t) {
self.x = x;
}
#[inline]
pub fn set_y(&mut self, y: $t) {
self.y = y;
pub fn clear(&mut self) {
self.x = 0.0;
self.y = 0.0;
}
}
)*};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment