[][src]Trait cubic_spline::TryFrom

pub trait TryFrom<T>: Sized {
    type Error;
    pub fn try_from(value: T) -> Result<Self, Self::Error>;

The same as TryFrom from std/core, except that it allows generic implementations. Details are in this issue

Official documentation

Usually you don't need to implement is yourself. This trait here is for safe conversion into Points


use cubic_spline::{TryFrom, Points, Error};

let my_points: Vec<(f64,f64)> = vec![(1.0, 1.0)];
let prepared_points = Points::try_from(&my_points);

assert_eq!(prepared_points.unwrap_err(), Error::TooFewPoints);

let another_try = Points::try_from( &[ [3.0, 5.1], [10.3, 11.9] ] );

Associated Types

type Error[src]

The type returned in the event of a conversion error.

Loading content...

Required methods

pub fn try_from(value: T) -> Result<Self, Self::Error>[src]

Performs the conversion.

Loading content...


impl<I: IntoIterator> TryFrom<I> for Points where
    I::Item: Into<Point>, 

type Error = Error

Loading content...