A fantastic crate for fmting numbers using the appropriate unciode characters.

Overview

fmtastic

Docs Crate Version

A fantastic crate for fmting numbers using the appropriate unicode characters via the Display trait.
Supports vulgar fractions, super- and subscript.

Contributions are welcome for more formats.

Features

Vulgar Fractions

Creates beautiful unicode fractions like ¼ or ¹⁰⁄₃.

use fmtastic::VulgarFraction;

assert_eq!("¹⁰⁄₃", format!("{}", VulgarFraction::new(10, 3)));
assert_eq!("¼", format!("{}", VulgarFraction::new(1, 4)));

Sub- and superscript

Formats integers as sub- or superscript.

use fmtastic::{Subscript, Superscript};

assert_eq!("x₁", format!("x{}", Subscript(1)));
assert_eq!("n²", format!("n{}", Superscript(2)));

Docs

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You might also like...
Alexander Mongus is a state-of-the-art filter to sneak amogus characters in pictures
Alexander Mongus is a state-of-the-art filter to sneak amogus characters in pictures

A. Mongus Go to: http://www.lortex.org/amogu/ ??? This is a client-side, Webassembly-based filter to hide amongus characters in your images. Example:

omekasy is a command line application that converts alphanumeric characters in your input to various styles defined in Unicode.

omekasy is a command line application that converts alphanumeric characters in your input to various styles defined in Unicode. omekasy means "dress up" in Japanese.

A tool to convert old and outdated "characters" into the superior Rustcii-Encoding.

rustcii A tool to convert old and outdated "characters" into the superior Rustcii-Encoding. Speak your mind. Blazingly ( 🦀 ) fast ( 🚀 ). Github | cr

A terminal clock that uses 7-segment display characters

Seven-segment clock (7clock) 7clock.3.mp4 This is a clock for terminals that uses the Unicode seven-segment display characters added in Unicode 13.0.

Split text into semantic chunks, up to a desired chunk size. Supports calculating length by characters and tokens

Large language models (LLMs) can be used for many tasks, but often have a limited context size that can be smaller than documents you might want to use. To use documents of larger length, you often have to split your text into chunks to fit within this context size.

🦀 Stupid simple presentation of the number of words, characters and lines on your clipboard.

clipcount: Counting words from the clipboard content Why does this exist? Do you find yourself often needing to count the number of words in a piece o

Keybinder to type diacrytical characters without needing to hack the layout itself. Supports bindings to the left Alt + letter

Ďíáǩříťíǩád I just thought that it's a shame the word diakritika does not have any diacritics in it. Key points diakritika is a simple Windows daemon

The auto-managed -sys crate for Apple platforms using bindgen directly from build environment

apple-sys Apple platforms have a rather monotonous programming environment compared to other platforms. On several development machines, we will depen

A rust crate for rendering large text to the terminal using font8x8 and ratatui.
A rust crate for rendering large text to the terminal using font8x8 and ratatui.

tui-big-text tui-big-text is a rust crate that renders large pixel text as a ratatui widget using the glyphs from the font8x8 crate. Installation carg

Comments
  • Replace module docs by readme

    Replace module docs by readme

    you can use #![doc = include_str!("../readme.md")] https://github.com/bash/fmtastic/blob/7a035a0d91bc55d8434cc98329dacd91ddaa4fe1/src/lib.rs#L1

    opened by janhohenheim 1
  • The CI does not validate docs currently

    The CI does not validate docs currently

    You may want to yoink this: https://github.com/yarn-slinger/yarn-slinger/blob/main/.github/workflows/ci.yml#L68 and this: https://github.com/yarn-slinger/yarn-slinger/blob/main/.github/workflows/ci.yml#L57

    opened by janhohenheim 0
  • The tests would read much nicer if you used a pseudo-theory

    The tests would read much nicer if you used a pseudo-theory

    https://github.com/bash/fmtastic/blob/7a035a0d91bc55d8434cc98329dacd91ddaa4fe1/src/sub_superscript.rs#L107 something like

    for (expected, input) in [("⁰", 0), ...] {
    	assert_eq!(expected, format!("{}", Superscript(input)));
    }
    

    Note thatt this does not apply to the formats involving formatting flags since you cannot (AFAIK) parametrize them

    opened by janhohenheim 0
Owner
~bash
maths student and wizard of the arts and crafts of programming :mage: :rainbow_flag:
~bash
A Rust library for drawing grid-based user interfaces using ASCII characters.

grux A library for drawing grid-based user interfaces using ASCII characters. // Provides a uniform interface for drawing to a 2D grid. use grux::Grid

Matan Lurey 4 Jan 10, 2023
Perspective projection of a spinning cube, using just ASCII characters.

Spinning Cube Perspective projection of a spinning cube, using just ASCII characters. spinning_cube.mp4 Instalation cargo install spinning_cube Basic

Guilherme Pagano 5 Aug 31, 2023
Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers

Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers. It deals only with integer arithmetic. Expressions may involve mixed bases (limited to decimal, hexadecimal, octal and binary numbers). The global output format may be set to a particular radix - by default it is hex.

Deep Majumder 50 Dec 22, 2022
CLI tool to convert numbers from one base to another

changebase A CLI tool for changing the base of numbers. > changebase -h numeric base converter USAGE: changebase [FLAGS] [OPTIONS] <value> FLAG

null 2 Oct 14, 2022
This repository presents a numbers vizualizer in a polar base. This small project has been entirely made in Rust !

NumbersRepresentation This repository presents a numbers vizualizer in a polar base. This small project has been entirely made in Rust ! This is an id

Lilian 'S3l4h' Schall 3 Apr 12, 2022
Multiple precision floating point numbers implemented purely in Rust.

Multiple precision floating point numbers implemented purely in Rust. Rationale There are several notable implementations of numbers with increased pr

null 11 Nov 23, 2022
A library for python version numbers and specifiers, implementing PEP 440

PEP440 in rust A library for python version numbers and specifiers, implementing PEP 440 Not yet on crates.io due to PyO3/pyo3#2786. use std::str::Fro

konstin 9 Dec 22, 2022
A complex numbers, graphing, cli calculator

calc requires gnuplot for graphing history file is stored in ~/.config/.calc_history or C:\\Users\\%USERNAME%\\AppData\\Roaming\\calc.history usage Us

null 6 May 21, 2023
Small CLI for escaping and unescaping characters in strings

?? esc Small CLI for escaping characters in strings. Install cargo install esc Usage cat LICENSE-MIT | esc escape | pbcopy pbpaste | esc unescape | pb

Seth 1 Nov 26, 2021
`boxy` - declarative box-drawing characters

boxy - declarative box-drawing characters Box-drawing characters are used extensively in text user interfaces software for drawing lines, boxes, and o

Miguel Young 7 Dec 30, 2022