On 18/11/13 18:02, Derek Chiang wrote:
Hi all,

I'm a newcomer to Rust. One of the things that I find confusing is the use of {} in formatted strings. In all other languages I've ever used, it's always %. So instead of writing "%d", you write "{:d}" in Rust. Why is this so? What benefits do we get?

Thanks,
Derek


_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

In addition to what Daniel said, being statically typed mean you can normally just write `{}` and let the std::fmt::Default implementation handle everything (for the primitive types it's the same as the {:d}, {:f}, {:s} etc).


Huon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to