Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements, clean up warnings, restructure constructors #81

Merged
merged 9 commits into from Jun 12, 2015
Prev

Migrate TypedPoint2D primary constructor to associated fn

  • Loading branch information
frewsxcv committed Jun 12, 2015
commit 94a3e028eb8b1f31100364d497a79ac9b4f4c50c
@@ -101,11 +101,11 @@ impl<Scale: Copy, T0: Div<Scale, Output=T1>, T1: Clone> Div<Scale> for Point2D<T

pub type TypedPoint2D<Unit, T> = Point2D<Length<Unit, T>>;

pub fn TypedPoint2D<Unit, T: Clone>(x: T, y: T) -> TypedPoint2D<Unit, T> {
Point2D::new(Length::new(x), Length::new(y))
}

impl<Unit, T: Clone> Point2D<Length<Unit, T>> {
pub fn typed(x: T, y: T) -> TypedPoint2D<Unit, T> {
Point2D::new(Length::new(x), Length::new(y))
}

/// Drop the units, preserving only the numeric value.
pub fn to_untyped(&self) -> Point2D<T> {
Point2D::new(self.x.get(), self.y.get())
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.