mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 23:02:31 +00:00
Add comment on performance
This commit is contained in:
parent
925956d594
commit
0a010a4371
1 changed files with 3 additions and 0 deletions
|
@ -479,6 +479,9 @@ macro_rules! crate_authors {
|
|||
self.authors.replace(Some(unwrapped_authors));
|
||||
unwrapped_authors
|
||||
} else {
|
||||
// This caches the result for subsequent invocations of the same instance of the macro
|
||||
// to avoid performing one memory allocation per call.
|
||||
// If performance ever becomes a problem for this code, it should be moved to build.rs
|
||||
let s: Box<String> = Box::new(env!("CARGO_PKG_AUTHORS").replace(':', $sep));
|
||||
let static_string = Box::leak(s);
|
||||
self.authors.replace(Some(&*static_string));
|
||||
|
|
Loading…
Reference in a new issue