anowell / interpolate

Very simple Rust string interpolation
MIT License
36 stars 3 forks source link

How to pass additional format args? #10

Open Boscop opened 4 years ago

Boscop commented 4 years ago

How can I replace this call:

format!(
    "transform-origin: {:.3}% center; transform: translateX({:.3}%) scaleX({:.3});",
    percent,
    100. - percent,
    self.zoom
)

with a call to interpolate::s? This doesn't work:

s!(
    "transform-origin: {percent:.3}% center; transform: translateX({100. - percent:.3}%) scaleX({self.zoom:.3});"
);

How to pass additional format args such as :.3?