How to use long_version command attribute with LazyCell? #5630
-
Hi there, I've got a version string being created in a const VERSION_STRING: LazyCell<String> = LazyCell::new(|| {
let pkg_version = option_env!("STACKS_NODE_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"));
let git_branch = GIT_BRANCH.unwrap_or("");
let git_commit = GIT_COMMIT.unwrap_or("");
format!(
"{} ({}:{}, {} build, {} [{}])",
pkg_version,
git_branch,
git_commit,
BUILD_TYPE,
std::env::consts::OS,
std::env::consts::ARCH
)
}); When trying to use this in the #[command(long_version = *VERSION_STRING)] I get the error:
Feels weird that I can't provide a Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
There should be a way to get a See Lines 577 to 585 in edcaf8f |
Beta Was this translation helpful? Give feedback.
-
The solution was to use |
Beta Was this translation helpful? Give feedback.
The solution was to use
static
instead ofconst
, andLazyLock
instead ofLazyCell
:) Then I could simply&*
it.