aboutsummaryrefslogtreecommitdiff
path: root/src/core/vector2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/vector2.rs')
-rw-r--r--src/core/vector2.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/vector2.rs b/src/core/vector2.rs
index 5afa0f2..3aadb46 100644
--- a/src/core/vector2.rs
+++ b/src/core/vector2.rs
@@ -3,6 +3,7 @@
//! This is implemented generictly with types that fit in the Number trait
use crate::{Float, Number};
use std::ops::{Sub, Add};
+use std::fmt;
#[derive(Clone, Copy)]
pub struct Vector2<T: Number> {
@@ -43,6 +44,12 @@ impl<T: Number> Add for Vector2<T> {
}
}
+impl<T: Number> fmt::Display for Vector2<T> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.write_fmt(format_args!("[{}, {}]", self.x, self.y))
+ }
+}
+
impl Vector2f {
pub fn ceil(&self) -> Self {
Self::new_xy(