in c++ I used this:
/** Amazing log method*/
template<typename... Args>
void inline log(Args const&... args)
{
std::string result;
std::ostringstream stream;
using List= int[];
(void)List{0, ( (void)(stream << args), 0 ) ... };
result = stream.str();
result = "[LOG] " + result;
//prints and writes string to log file with timestamp.
logg(result);
}
//example usage:
log("The final number is not: ", 12,", it's: ", 136.0f)
//outputs: [TIME] The final number is not: 12, it's: 136.0f
Is it possible to write something similar in rust with variadics? How would you turn all parameters of any primitive type into string?