1
use crate::{Figure, Point};
2

            
3
impl<T, U> Point<T, U>
4
where
5
    T: Default + Copy,
6
{
7
    /// Returns a new point with `x`, and `T::default()` for `y`.
8
1
    pub fn from_x(x: impl Into<Figure<T, U>>) -> Self {
9
1
        Self::new(x.into().get(), T::default())
10
1
    }
11

            
12
    /// Returns a new point with `y`, and `T::default()` for `x`.
13
1
    pub fn from_y(y: impl Into<Figure<T, U>>) -> Self {
14
1
        Self::new(T::default(), y.into().get())
15
1
    }
16
}
17

            
18
1
#[test]
19
1
fn point_from_partial_tests() {
20
1
    assert_eq!(Point::<u32, ()>::from_x(1), Point::new(1, 0));
21
1
    assert_eq!(Point::<u32, ()>::from_y(1), Point::new(0, 1));
22
1
}