#types #ufo #glif #no-std #font-format

no-std integer_or_float

A data type holding an ‘integer or float’ (a data type in the Unified Font Object specification, among others)

5 unstable releases

0.3.2 Feb 3, 2023
0.3.1 Jan 2, 2023
0.3.0 Jan 2, 2023
0.2.0 Jan 1, 2023
0.1.5 Dec 13, 2022

#381 in Rust patterns

Download history 32/week @ 2023-01-24 53/week @ 2023-01-31 19/week @ 2023-02-07 37/week @ 2023-02-14 28/week @ 2023-02-21 16/week @ 2023-02-28 64/week @ 2023-03-07 22/week @ 2023-03-14 15/week @ 2023-03-21 48/week @ 2023-03-28 19/week @ 2023-04-04 16/week @ 2023-04-11 11/week @ 2023-04-18 15/week @ 2023-04-25 17/week @ 2023-05-02 33/week @ 2023-05-09

77 downloads per month
Used in 5 crates (via glifparser)


765 lines

integer_or_float v0.3.2

This is a Rust type that holds an integer or a float.

// from src/backing_types.rs
#[cfg(not(feature = "x64-backing-store"))]
pub type f_iof = f32;
#[cfg(not(feature = "x64-backing-store"))]
pub type i_iof = i32;

/// A generic container for an "integer or a float".
pub enum IntegerOrFloat {

At first it was just a Rust implementation of the UFO datatype integer or float, which appears all over the UFO spec, but most importantly in the affine matrices used by glyph components.

Now (v0.1.4) it's generic. You can compile with the experimental feature x64-backing-store to get an IntegerOrFloat defined as such:

pub enum IntegerOrFloat {

Rather than the default:

pub enum IntegerOrFloat {

Discretionary features


Enables serde with serde/std.


Enables float-cmp and num-traits crates, which provide ::ApproxEq and ::{cast::ToPrimitive, Zero, One, NumCast} respectively.


Enables Ryū (龍), for faster float→string conversions.


As of v0.2, an alias for numerical-traits. This is a breaking change from v0.1, serde no longer default!


As of v0.2, enables all.


    Copyright 2022 Fredrick R. Brennan <copypaste@kittens.ph>

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at


    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.


~34K SLoC