Add docs to declare_id macro (#10671)
This commit is contained in:
parent
c151e783ca
commit
f37d2d5a58
|
@ -41,12 +41,15 @@ impl ToTokens for Id {
|
|||
fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
|
||||
let id = &self.0;
|
||||
tokens.extend(quote! {
|
||||
/// The static program ID
|
||||
pub static ID: ::solana_sdk::pubkey::Pubkey = #id;
|
||||
|
||||
/// Confirms that a given pubkey is equivalent to the program ID
|
||||
pub fn check_id(id: &::solana_sdk::pubkey::Pubkey) -> bool {
|
||||
id == &ID
|
||||
}
|
||||
|
||||
/// Returns the program ID
|
||||
pub fn id() -> ::solana_sdk::pubkey::Pubkey {
|
||||
ID
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue