diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-08-28 02:22:45 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-09-12 00:36:54 -0700 |
| commit | 9a5f95a82c2836fa6c57ede49d27c060f2377fa1 (patch) | |
| tree | a6548120a917b0a1eaa9afe5cb9595e5c96c377c /src/rt/jemalloc/test/aligned_alloc.exp | |
| parent | 62166611e7510b86f395dbf19973e442fd43c403 (diff) | |
| download | rust-9a5f95a82c2836fa6c57ede49d27c060f2377fa1.tar.gz rust-9a5f95a82c2836fa6c57ede49d27c060f2377fa1.zip | |
Implement a format_args!() macro
The purpose of this macro is to further reduce the number of allocations which occur when dealing with formatting strings. This macro will perform all of the static analysis necessary to validate that a format string is safe, and then it will wrap up the "format string" into an opaque struct which can then be passed around. Two safe functions are added (write/format) which take this opaque argument structure, unwrap it, and then call the unsafe version of write/format (in an unsafe block). Other than these two functions, it is not intended for anyone to ever look inside this opaque struct. The macro looks a bit odd, but mostly because of rvalue lifetimes this is the only way for it to be safe that I know of. Example use-cases of this are: * third-party libraries can use the default formatting syntax without any forced allocations * the fail!() macro can avoid allocating the format string * the logging macros can avoid allocation any strings
Diffstat (limited to 'src/rt/jemalloc/test/aligned_alloc.exp')
0 files changed, 0 insertions, 0 deletions
