fork download
  1. fn foo(message: Message, content: String) -> Result<(), Error> {
  2. let message_content = format!("```\n{}\n```", table_str);
  3. let mut msg = htc.create_message(message.channel_id)
  4. .reply(message.message_id)
  5. .content(&message_content)
  6.  
  7. let mut attachments_storage: Option<[Attachment, 1]> = None;
  8. match msg {
  9. Err(e) => match e.kind() {
  10. MessageValidationErrorType::ContentInvalid => {
  11. attachments_storage = Some([Attachment::from_bytes("foo.txt".to_owned(), content.into_bytes(), 1)]);
  12. msg = htc.create_message(message.channel_id)
  13. .reply(message.message_id)
  14. .attachments(attachments_storage.as_ref().unwrap())
  15. .content("foo")
  16. },
  17. _ => {}
  18. }
  19. }
  20.  
  21. let Ok(msg) = msg else {
  22. return Err(Error("CME"));
  23. }
  24.  
  25. msg.await?;
  26. Ok(())
  27. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
error: expected `;`, found keyword `let`
 --> prog.rs:5:29
  |
5 |         .content(&message_content)
  |                                   ^ help: add `;` here
6 |         
7 |     let mut attachments_storage: Option<[Attachment, 1]> = None;
  |     --- unexpected token

error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `,`
 --> prog.rs:7:49
  |
7 |     let mut attachments_storage: Option<[Attachment, 1]> = None;
  |         -----------------------                    ^ expected one of 7 possible tokens
  |         |
  |         while parsing the type for `mut attachments_storage`

error[E0412]: cannot find type `Message` in this scope
 --> prog.rs:1:17
  |
1 | fn foo(message: Message, content: String) -> Result<(), Error> {
  |                 ^^^^^^^ not found in this scope

error[E0412]: cannot find type `Error` in this scope
 --> prog.rs:1:57
  |
1 | fn foo(message: Message, content: String) -> Result<(), Error> {
  |                                                         ^^^^^ not found in this scope
  |
help: consider importing one of these items
  |
1 | use std::error::Error;
  |
1 | use std::fmt::Error;
  |
1 | use std::io::Error;
  |

error[E0425]: cannot find value `table_str` in this scope
 --> prog.rs:2:48
  |
2 |     let message_content = format!("```\n{}\n```", table_str);
  |                                                   ^^^^^^^^^ not found in this scope

error[E0425]: cannot find value `htc` in this scope
 --> prog.rs:3:16
  |
3 |     let mut msg = htc.create_message(message.channel_id)
  |                   ^^^ not found in this scope

error[E0601]: `main` function not found in crate `prog`
  --> prog.rs:1:1
   |
1  | / fn foo(message: Message, content: String) -> Result<(), Error> {
2  | |     let message_content = format!("```\n{}\n```", table_str);
3  | |     let mut msg = htc.create_message(message.channel_id)
4  | |         .reply(message.message_id)
...  |
26 | |     Ok(())
27 | | }
   | |_^ consider adding a `main` function to `prog.rs`

error: aborting due to 7 previous errors

Some errors have detailed explanations: E0412, E0425, E0601.
For more information about an error, try `rustc --explain E0412`.
stdout
Standard output is empty