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

Migrate TypedSize2D primary constructor to associated fn

  • Loading branch information
frewsxcv committed Jun 12, 2015
commit 5d1b5dd5317e0772d9cf36c5410c7aece34d5e05
@@ -83,11 +83,11 @@ impl<Scale: Copy, T0: Div<Scale, Output=T1>, T1: Clone> Div<Scale> for Size2D<T0

pub type TypedSize2D<Unit, T> = Size2D<Length<Unit, T>>;

pub fn TypedSize2D<Unit, T: Clone>(width: T, height: T) -> TypedSize2D<Unit, T> {
Size2D::new(Length::new(width), Length::new(height))
}

impl<Unit, T: Clone> Size2D<Length<Unit, T>> {
pub fn typed(width: T, height: T) -> TypedSize2D<Unit, T> {
Size2D::new(Length::new(width), Length::new(height))
}

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