lib.rs 764 B

123456789101112131415161718192021222324252627282930
  1. //! Testing the extraction of doc comments from the IDL.
  2. use anchor_lang::prelude::*;
  3. declare_id!("Docs111111111111111111111111111111111111111");
  4. /// This is a doc comment for the program
  5. #[program]
  6. pub mod docs {
  7. use super::*;
  8. /// This instruction doc should appear in the IDL
  9. pub fn test_idl_doc_parse(_ctx: Context<TestIdlDocParse>) -> Result<()> {
  10. Ok(())
  11. }
  12. }
  13. /// Custom account doc comment should appear in the IDL
  14. #[account]
  15. pub struct DataWithDoc {
  16. /// Account attribute doc comment should appear in the IDL
  17. pub data: u16,
  18. }
  19. #[derive(Accounts)]
  20. pub struct TestIdlDocParse<'info> {
  21. /// This account doc comment should appear in the IDL
  22. /// This is a multi-line comment
  23. pub act: Account<'info, DataWithDoc>,
  24. }