Crates.io | py_fstr |
lib.rs | py_fstr |
version | 0.1.0 |
source | src |
created_at | 2023-04-10 19:45:09.636647 |
updated_at | 2023-04-10 19:45:09.636647 |
description | A macro for making Python like fstrings |
homepage | https://github.com/AharonSambol/rust_macros/tree/main/py_fstr |
repository | https://github.com/AharonSambol/rust_macros/tree/main/py_fstr |
max_upload_size | |
id | 835388 |
size | 5,565 |
Macro for Python-like f-strings in Rust.
Basically just the format!
macro but lets you put any expression in the braces
def add_one(i: int) -> int:
return i + 1
def main():
b = 3
a = f"awow look { add_one(b * 2) }!"
print(a)
use py_fstr::f;
fn add_one(i: i32) -> i32 {
i + 1
}
fn main() {
let b = 3;
let a = f!("awow look { add_one(b * 2) }!");
println!("{a}");
}
Add the following line to your Cargo.toml file:
py_fstr = "0.1.0"