Trait decorum::FloatProxy [] [src]

pub trait FloatProxy<T>: Sized where
    T: Float + Primitive
{ fn from_raw_float(value: T) -> Self;
fn into_raw_float(self) -> T; }

A floating point proxy.

This trait allows code to be generic over proxy types and exposes functions for converting primitives to and from a proxy.

This would typically be used along with other bounds, such as Eq + FloatProxy<T> + Hash or FloatProxy<T> + Real.

It is not necessary to import this trait to use these functions; because it would be burdensome to import this every time a proxy is used, the trait implementation simply forwards calls to functions directly associated with the type.

Required Methods

Converts a primitive into a floating point proxy.

Panics

If the enforce-constraints feature is enabled, then this function will panic if the primitive value is not allowed by the contraints of the proxy. If the feature is disabled, this function will always succeed.

Converts the float proxy into a primitive value.

Implementors