Skip to content

Commit

Permalink
Document cfg!(feature = "x64-backing-store")
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlcctrlv committed Jun 16, 2022
1 parent 663c773 commit 05e2c60
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "integer_or_float"
version = "0.1.3"
version = "0.1.4"
authors = ["Fredrick Brennan <[email protected]>"]
edition = "2021"
build = "build.rs"
Expand Down
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# `integer_or_float`
# `integer_or_float` v0.1.4

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

```rust
// 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 {
Integer(i_iof),
Float(f_iof)
}
```

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:

```rust
pub enum IntegerOrFloat {
Integer(i64),
Float(f64)
}
```

Rather than the default:

```rust
pub enum IntegerOrFloat {
Integer(i32),
Float(f32)
}
```

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.
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ mod num_traits_impl;
mod str_conv;
pub use str_conv::ConversionError;

/// The UFO data type "integer or float".
/// A generic container for an "integer or a float".
///
/// Was made originally for the UFO data type "integer or float".
#[cfg_attr(use_serde, derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone)]
pub enum IntegerOrFloat {
Expand Down

0 comments on commit 05e2c60

Please sign in to comment.