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.