-
Notifications
You must be signed in to change notification settings - Fork 4
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
Introduce new methods to construct subaccount id from an existing AccountIdRef and a prefix #23
Comments
I'm a bit confused: |
@Jujumba Good catch! I have just fixed the signature. I expect const-generics to be used at compile time to concatenate the str slices. Here is the crate I would explore using: https://crates.io/crates/constcat |
I'm not sure that it's possible to concatenate these slices at const context. |
@Jujumba That is not true: https://docs.rs/near-account-id/latest/src/near_account_id/account_id_ref.rs.html#84-88 |
Oh, you meant this. Then you are absolutely right. I thought of the following: pub fn function<const S: &'static str>() {
} |
I see the following two methods to be useful:
AccountIdRef::new_subaccount_id(&self, subaccount_name: &str) -> Result<AccountId, ParseAccountError>
const fn AccountIdRef::new_subaccount_id_or_panic(&self, subaccount_name: &str) -> &AccountIdRef
Here is a usage example:
Good first issues note:
The text was updated successfully, but these errors were encountered: