Files
swift-nio-imap/Sources/IMAPCommands/ContinuationWriter.swift
T

42 lines
1.4 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2026 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import NIO
import NIOIMAP
extension IMAPConnection {
/// Sends continuation data to the server during authentication.
public struct ContinuationWriter: ~Copyable, Sendable {
var underlying: OutboundQueue
/// Sends the given bytes as a continuation response.
///
/// - Throws: ``IMAPConnection/Error`` if the connection fails or is closed.
public func writeContinuation(
_ bytes: ByteBuffer
) async throws(IMAPConnection.Error) {
try await underlying.writeContinuationResponse(bytes)
}
/// Sends the given byte sequence as a continuation response.
///
/// - Throws: ``IMAPConnection/Error`` if the connection fails or is closed.
public func writeContinuation(
_ bytes: some Sequence<UInt8>
) async throws(IMAPConnection.Error) {
try await writeContinuation(ByteBuffer(bytes: bytes))
}
}
}