1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Description: drop broken example
Author: Jonas Smedegaard <dr@jones.dk>
Bug: https://github.com/pimalaya/imap-client/issues/16
Last-Update: 2025-02-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/examples/fetch.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use imap_client::{
- imap_types::{
- fetch::{Macro, MacroOrMessageDataItemNames, MessageDataItem},
- sequence::SequenceSet,
- },
- Client,
-};
-
-const USAGE: &str =
- "USAGE: cargo run --example=fetch -- <host> <port> <username> <password>";
-
-#[tokio::main]
-async fn main() {
- let (host, port, username, password) = {
- let mut args = std::env::args();
- let _ = args.next();
-
- (
- args.next().expect(USAGE),
- str::parse::<u16>(&args.next().expect(USAGE)).unwrap(),
- args.next().expect(USAGE),
- args.next().expect(USAGE),
- )
- };
-
- let mut client = Client::tls(host, port).await.unwrap();
-
- client.authenticate_plain(username, password).await.unwrap();
-
- let select_data = client.select("inbox").await.unwrap();
- println!("{select_data:?}\n");
-
- let data = client
- .fetch(
- SequenceSet::try_from("1:10").unwrap(),
- MacroOrMessageDataItemNames::Macro(Macro::Full),
- )
- .await
- .unwrap();
-
- println!("# INBOX\n");
- for (_, items) in data {
- let envelope = items
- .as_ref()
- .iter()
- .find(|item| matches!(item, MessageDataItem::Envelope(_)))
- .unwrap();
- if let MessageDataItem::Envelope(env) = envelope {
- if let Some(sub) = &env.subject.0 {
- println!("* {:?}", std::str::from_utf8(sub.as_ref()).unwrap());
- }
- }
- }
-}
|