Files
swift-nio-imap/Sources/NIOIMAPCore/Grammar/ByteRange/MessagePathByteRange.swift
T
Daniel Eggert 8b8d972682 Remove dead URL and date writers
`writeAuthIMAPURLRump`, `writeAuthIMAPURLFull`, `writeRelativeIMAPURL`,
`writeURLFetchType`, `writeInternetMessageDate` and
`writeListSelectBaseOptionQuoted` had no callers outside their own
encode tests, nor did the writers only they reached
(`writeAuthenticatedURL(NetworkMessagePath)`, `writeNetworkPath`,
`writeAbsoluteMessagePath`, `writeIUIDOnly`,
`writeURLMessageSectionOnly`, `writeMessagePathByteRangeOnly`). Delete
them and those tests; parse tests stay.
2026-11-03 14:59:38 +01:00

42 lines
1.5 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020 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
//
//===----------------------------------------------------------------------===//
extension MessagePath {
/// A byte range suffix for partial IMAP URL fetches.
///
/// Wraps a ``/NIOIMAPCore/ByteRange`` for use in IMAP URLs with the `/;PARTIAL=` encoding
/// (RFC 5092). It enables clients to request only a portion of a message via URL without
/// downloading the entire body.
///
/// - SeeAlso: [RFC 5092 IMAP URL Scheme](https://datatracker.ietf.org/doc/html/rfc5092)
public struct ByteRange: Hashable, Sendable {
/// The underlying ``/NIOIMAPCore/ByteRange``.
public var range: NIOIMAPCore.ByteRange
/// Creates a new `MessagePath.ByteRange`.
/// - parameter range: The ``/NIOIMAPCore/ByteRange`` to be wrapped.
public init(range: NIOIMAPCore.ByteRange) {
self.range = range
}
}
}
// MARK: - Encoding
extension EncodeBuffer {
@discardableResult mutating func writeMessagePathByteRange(_ data: MessagePath.ByteRange) -> Int {
self.writeString("/;PARTIAL=") + self.writeByteRange(data.range)
}
}