Trait Float

Source
pub trait Float<B: Buffer<Token = u8>>: Sized {
    // Required method
    unsafe fn parse_buffer<I: Input<Token = u8, Buffer = B>>(
        i: I,
        b: B,
    ) -> SimpleResult<I, Self>;
}
Expand description

Trait enabling the conversion from a matched Buffer to a float of the correct type.

Required Methods§

Source

unsafe fn parse_buffer<I: Input<Token = u8, Buffer = B>>( i: I, b: B, ) -> SimpleResult<I, Self>

Given an input and a buffer matching /[+-]?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)/, convert this buffer into the proper float-representation, error if it is not possible to determine the correct representation.

NOTES:

  • Unsafe because the parse_buffer implementation should be able to rely on the format of the incoming buffer (including well-formed UTF-8).

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<B> Float<B> for f32
where B: Buffer<Token = u8>,

Source§

unsafe fn parse_buffer<I: Input<Token = u8>>( i: I, b: B, ) -> SimpleResult<I, Self>

Source§

impl<B> Float<B> for f64
where B: Buffer<Token = u8>,

Source§

unsafe fn parse_buffer<I: Input<Token = u8>>( i: I, b: B, ) -> SimpleResult<I, Self>

Implementors§