mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-15 20:07:57 +08:00
adjust Result::Io api
This commit is contained in:
@@ -23,7 +23,7 @@ impl CloseMailboxCommand {
|
||||
|
||||
loop {
|
||||
match close_coroutine.resume(arg.take()) {
|
||||
ImapCloseResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapCloseResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapCloseResult::Ok { .. } => break,
|
||||
ImapCloseResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ impl CreateMailboxCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapCreateResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapCreateResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapCreateResult::Ok { .. } => break,
|
||||
ImapCreateResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ impl DeleteMailboxCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapDeleteResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapDeleteResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapDeleteResult::Ok { .. } => break,
|
||||
ImapDeleteResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ impl ExpungeMailboxCommand {
|
||||
|
||||
let context = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapSelectResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapSelectResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapSelectResult::Ok { context, .. } => break context,
|
||||
ImapSelectResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
@@ -41,7 +41,7 @@ impl ExpungeMailboxCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapExpungeResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapExpungeResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapExpungeResult::Ok { .. } => break,
|
||||
ImapExpungeResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ impl ListMailboxesCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapListResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapListResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapListResult::Ok { mailboxes, .. } => break mailboxes,
|
||||
ImapListResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
@@ -46,7 +46,7 @@ impl ListMailboxesCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapLsubResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapLsubResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapLsubResult::Ok { mailboxes, .. } => break mailboxes,
|
||||
ImapLsubResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ impl PurgeMailboxCommand {
|
||||
|
||||
let context = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapSelectResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapSelectResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapSelectResult::Ok { context, .. } => break context,
|
||||
ImapSelectResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
@@ -53,7 +53,7 @@ impl PurgeMailboxCommand {
|
||||
|
||||
let context = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapStoreSilentResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapStoreSilentResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapStoreSilentResult::Ok { context, .. } => break context,
|
||||
ImapStoreSilentResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
@@ -65,7 +65,7 @@ impl PurgeMailboxCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapExpungeResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapExpungeResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapExpungeResult::Ok { .. } => break,
|
||||
ImapExpungeResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ impl RenameMailboxCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapRenameResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapRenameResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapRenameResult::Ok { .. } => break,
|
||||
ImapRenameResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ impl StatusMailboxCommand {
|
||||
|
||||
let items = loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapStatusResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapStatusResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapStatusResult::Ok { items, .. } => break items,
|
||||
ImapStatusResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ impl SubscribeMailboxCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapSubscribeResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapSubscribeResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapSubscribeResult::Ok { .. } => break,
|
||||
ImapSubscribeResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ impl UnselectMailboxCommand {
|
||||
|
||||
let context = loop {
|
||||
match select_coroutine.resume(arg.take()) {
|
||||
ImapSelectResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapSelectResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapSelectResult::Ok { context, .. } => break context,
|
||||
ImapSelectResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
@@ -40,7 +40,7 @@ impl UnselectMailboxCommand {
|
||||
|
||||
loop {
|
||||
match unselect_coroutine.resume(arg.take()) {
|
||||
ImapUnselectResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapUnselectResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapUnselectResult::Ok { .. } => break,
|
||||
ImapUnselectResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ impl UnsubscribeMailboxCommand {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapUnsubscribeResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapUnsubscribeResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapUnsubscribeResult::Ok { .. } => break,
|
||||
ImapUnsubscribeResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
+6
-6
@@ -96,7 +96,7 @@ pub fn connect(mut config: ImapConfig) -> Result<(ImapContext, Stream)> {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
GetImapGreetingWithCapabilityResult::Io(io) => {
|
||||
GetImapGreetingWithCapabilityResult::Io { io } => {
|
||||
arg = Some(handle(&mut stream, io)?)
|
||||
}
|
||||
GetImapGreetingWithCapabilityResult::Ok { context: c } => break context = c,
|
||||
@@ -116,7 +116,7 @@ pub fn connect(mut config: ImapConfig) -> Result<(ImapContext, Stream)> {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapStartTlsResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapStartTlsResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapStartTlsResult::Ok { context: c } => break context = c,
|
||||
ImapStartTlsResult::Err { err, .. } => Err(err)?,
|
||||
}
|
||||
@@ -247,7 +247,7 @@ pub fn connect(mut config: ImapConfig) -> Result<(ImapContext, Stream)> {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
GetImapCapabilityResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
GetImapCapabilityResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
GetImapCapabilityResult::Ok { context: c } => break context = c,
|
||||
GetImapCapabilityResult::Err { err, .. } => Err(err)?,
|
||||
}
|
||||
@@ -258,7 +258,7 @@ pub fn connect(mut config: ImapConfig) -> Result<(ImapContext, Stream)> {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
GetImapGreetingWithCapabilityResult::Io(io) => {
|
||||
GetImapGreetingWithCapabilityResult::Io { io } => {
|
||||
arg = Some(handle(&mut stream, io)?)
|
||||
}
|
||||
GetImapGreetingWithCapabilityResult::Ok { context: c } => {
|
||||
@@ -280,7 +280,7 @@ pub fn connect(mut config: ImapConfig) -> Result<(ImapContext, Stream)> {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
GetImapGreetingWithCapabilityResult::Io(io) => {
|
||||
GetImapGreetingWithCapabilityResult::Io { io } => {
|
||||
arg = Some(handle(&mut stream, io)?)
|
||||
}
|
||||
GetImapGreetingWithCapabilityResult::Ok { context: c } => break context = c,
|
||||
@@ -367,7 +367,7 @@ pub fn connect(mut config: ImapConfig) -> Result<(ImapContext, Stream)> {
|
||||
|
||||
loop {
|
||||
match coroutine.resume(arg.take()) {
|
||||
ImapAuthenticateResult::Io(io) => arg = Some(handle(&mut stream, io)?),
|
||||
ImapAuthenticateResult::Io { io } => arg = Some(handle(&mut stream, io)?),
|
||||
ImapAuthenticateResult::Ok { context: c, .. } => break context = c,
|
||||
ImapAuthenticateResult::Err { err, .. } => bail!(err),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user