Trait libreda_pnr::db::TryCastCoord[][src]

pub trait TryCastCoord<Src, Dst> where
    Src: NumCast,
    Dst: NumCast
{ type Output; fn try_cast(&self) -> Option<Self::Output>; fn cast(&self) -> Self::Output { ... } }
Expand description

This trait defines the type-casting of the coordinate types for geometrical objects.

Associated Types

Output type of the cast. This is likely the same geometrical type just with other coordinate types.

Required methods

Try to cast to target data type.

Conversion from float to int can fail and will return None. Float values like infinity or non-a-number have no integer representation.

Provided methods

Cast to target data type.

Conversion from float to int can fail and panic because float values like infinity or non-a-number have no integer representation.

Panics

Panics if casting of the coordinate values fails. For instance when trying to cast a ‘NaN’ float into a integer. Use try_cast to detect and handle this failure.

Implementors