Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is crate::sui_types::id::UID::new not const? #20137

Open
jymchng opened this issue Nov 1, 2024 · 2 comments
Open

Why is crate::sui_types::id::UID::new not const? #20137

jymchng opened this issue Nov 1, 2024 · 2 comments
Assignees
Labels

Comments

@jymchng
Copy link

jymchng commented Nov 1, 2024

pub fn new(bytes: ObjectID) -> Self {

Issue: Why is crate::sui_types::id::UID::new not const?

It should be const fn because ObjectID and AccountAddress can be constructed in const context and UID is a wrapper around ObjectID, hence it must be able to be constructed in the const context.

Furthermore, it appears in crate::sui_types::coin::CoinMetadata struct, and since it is 'metadata', it should be able to be constructed in const context too!

@jymchng
Copy link
Author

jymchng commented Nov 1, 2024

@sblackshear @patrickkuo

@stefan-mysten stefan-mysten self-assigned this Nov 1, 2024
@stefan-mysten
Copy link
Contributor

@jymchng thanks for the question. It seems that this would be possible. Would you be willing to push up a PR? We'd be happy to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants