Hacker News new | past | comments | ask | show | jobs | submit login

There is exactly one useful thing you can do with an `Arguments` object: call `.fmt()` on it.

The whole reason for std::Arguments very existence is to call `std::Arguments::fmt` on it.

`.fmt()` is a trait implementation, but that doesn’t change anything (not sure what “kind of thing” refers to here). It’s still a function on std::Arguments.






I think you're quite muddled about what's going on here

The full name of this type is std::fmt::Arguments not std::Arguments and even so there's no such thing as std::fmt::Arguments::fmt - there is no function with that name, we can only talk about this name (since it doesn't exist) if we bring into context a specific trait such as Display or Debug

So the full name of the thing you think is the "one useful thing you can do with Arguments" is

<std::fmt::Arguments as std::fmt::Display>::fmt

or perhaps it's

<std::fmt::Arguments as std::fmt::Debug>::fmt

... as I said, Arguments implements both traits, and their sole function has the same name so we need to disambiguate somehow if we mean one of these functions or the other. For the function defined on Arguments itself, as_str, it's already unambiguous.

In the end the Debug and Display traits are all just ductwork, which is why as_str caught my attention.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: