Files
T
Cory Benfield 27e163f96a Rename a number of types and modules. (#13)
Motivation:

In general we should try to be specific about what we're referring to.
"Structured headers" is not really an accurate description of what this
module works with: "Structured Header Field Values", or "Structured
Field Value" is usually better. To that end this change adjusts our
naming to be closer to what we want. It also changes our module names to
prioritise the use of the Codable-based one.

Modifications:

- Renamed CodableStructuredHeaders to StructuredFieldValues.
- Renamed StructuredHeaders to RawStructuredFieldValues.
- Renamed a number of types from Field to FieldValue.
- Renamed a number of types from Header to Field or FieldValue.
- Renamed some functions along the above lines.

Result:

Better and more consistent terminology will be used.
2021-07-02 11:48:41 +01:00

35 lines
1.2 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2020-2021 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
//
//===----------------------------------------------------------------------===//
/// A `StructuredFieldValue` is a `Codable` representation of a HTTP Structured
/// Header Field.
///
/// This protocol is a helper protocol that refines `Codable` to indicate what kind
/// of header field a given field uses.
public protocol StructuredFieldValue: Codable {
static var structuredFieldType: StructuredFieldType { get }
}
/// The kinds of header fields used in HTTP Structured Headers.
public enum StructuredFieldType {
/// An item field consists of a single item, optionally with parameters.
case item
/// A list field consists of a list made up of inner lists or items.
case list
/// A dictionary field is an ordered collection of key-value pairs.
case dictionary
}