Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ct-austin/ifmt
Inline expression interpolation for Rust.
https://github.com/ct-austin/ifmt
macro proc-macro rust rust-crate string-interpolation strings sugar syntax
Last synced: 4 months ago
JSON representation
Inline expression interpolation for Rust.
- Host: GitHub
- URL: https://github.com/ct-austin/ifmt
- Owner: ct-austin
- License: other
- Created: 2019-04-20T07:44:46.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-09-02T11:54:28.000Z (over 1 year ago)
- Last Synced: 2024-10-29T04:41:05.745Z (4 months ago)
- Topics: macro, proc-macro, rust, rust-crate, string-interpolation, strings, sugar, syntax
- Language: Rust
- Homepage: https://crates.io/crates/ifmt
- Size: 33.2 KB
- Stars: 200
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# ifmt
A small crate which brings inline string interpolation to rust's standard formatting macros.## Getting started
To use ifmt in your project, add
```toml
[dependencies]
ifmt = "0.3.3"
```
to your Cargo.toml.## Examples
```rust
let four = 4;
iprintln!("four plus four is: " four + 4);
// four plus four is: 8
iprintln!("here's a hex number: 0x" 0xb0bi64 * 1321517i64 ;x);
// here's a hex number: 0xdeadbeef
iprintln!("here's a debugging value: " Some(four);?);
// here's a debugging value: Some(4)
```## Supported macros
```
format! -> iformat!
print! -> iprint!
println! -> iprintln!
eprint! -> ieprint!
eprintln! -> ieprintln!
write! -> iwrite!
writeln! -> iwriteln!
panic! -> ipanic!
format_args! -> iformat_args!
```## License
This project is licensed under the MIT license or the Apache 2.0 license at your option.