pub trait FromTuple2<T> {
// Required method
fn from_tuple2(tuple: (T, T)) -> Self;
}Expand description
To manipulate many Point libraries in the same way, we use tuple as entry points of API.
§Example
use rect_iter::FromTuple2;
struct Point {
x: f64,
y: f64,
}
impl FromTuple2<f64> for Point {
fn from_tuple2(t: (f64, f64)) -> Self {
Point { x: t.0, y: t.1 }
}
}Required Methods§
fn from_tuple2(tuple: (T, T)) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<T> FromTuple2<T> for (T, T)
impl<T> FromTuple2<T> for (T, T)
fn from_tuple2(t: (T, T)) -> Self
Source§impl<T: Clone, U> FromTuple2<T> for Vector2D<T, U>
Available on crate feature euclid only.
impl<T: Clone, U> FromTuple2<T> for Vector2D<T, U>
Available on crate feature
euclid only.fn from_tuple2(t: (T, T)) -> Vector2D<T, U>
Source§impl<T: Copy, U> FromTuple2<T> for Point2D<T, U>
Available on crate feature euclid only.
impl<T: Copy, U> FromTuple2<T> for Point2D<T, U>
Available on crate feature
euclid only.