Int
A signed integer value type.
@frozen struct Int
On 32-bit platforms, Int
is the same size as Int32
, and on 64-bit platforms, Int
is the same size as Int64
.
A signed integer value type.
@frozen struct Int
On 32-bit platforms, Int
is the same size as Int32
, and on 64-bit platforms, Int
is the same size as Int64
.
import Swift
protocol AdditiveArithmetic : Equatable
A type with values that support addition and subtraction.
protocol BinaryInteger : CustomStringConvertible, Hashable, Numeric, Strideable where Self.Magnitude : BinaryInteger, Self.Magnitude == Self.Magnitude.Magnitude
An integer type with a binary representation.
protocol BitwiseCopyable
protocol CVarArg
A type whose instances can be encoded, and appropriately passed, as elements of a C va_list
.
protocol CodingKeyRepresentable
A type that can be converted to and from a coding key.
protocol Comparable : Equatable
A type that can be compared using the relational operators <
, <=
, >=
, and >
.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol CustomReflectable
A type that explicitly supplies its own mirror.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
protocol ExpressibleByIntegerLiteral
A type that can be initialized with an integer literal.
protocol FixedWidthInteger : BinaryInteger, LosslessStringConvertible where Self.Magnitude : FixedWidthInteger, Self.Magnitude : UnsignedInteger, Self.Stride : FixedWidthInteger, Self.Stride : SignedInteger
An integer type that uses a fixed size for every instance.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol LosslessStringConvertible : CustomStringConvertible
A type that can be represented as a string in a lossless, unambiguous way.
protocol MirrorPath
A protocol for legitimate arguments to Mirror
’s descendant
method.
protocol Numeric : AdditiveArithmetic, ExpressibleByIntegerLiteral
A type with values that support multiplication.
protocol SIMDScalar : BitwiseCopyable
A type that can be used as an element in a SIMD vector.
protocol Sendable
protocol SignedInteger : BinaryInteger, SignedNumeric
An integer type that can represent both positive and negative values.
protocol SignedNumeric : Numeric
A numeric type with a negation operation.
protocol Strideable<Stride> : Comparable
A type representing continuous, one-dimensional values that can be offset and measured.
init(_ source: Double)
Creates an integer from the given floating-point value, rounding toward zero.
init(_ source: Float)
Creates an integer from the given floating-point value, rounding toward zero.
init(_ source: Float16)
Creates an integer from the given floating-point value, rounding toward zero.
init(bitPattern objectID: ObjectIdentifier)
Creates an integer that captures the full value of the given object identifier.
init(bitPattern x: UInt)
Creates a new instance with the same memory representation as the given value.
init(bitPattern pointer: OpaquePointer?)
Creates a new value with the bit pattern of the given pointer.
init<P>(bitPattern pointer: P?) where P : _Pointer
Creates a new value with the bit pattern of the given pointer.
init?<T>(codingKey: T) where T : CodingKey
init?(exactly source: Double)
Creates an integer from the given floating-point value, if it can be represented exactly.
init?(exactly source: Float)
Creates an integer from the given floating-point value, if it can be represented exactly.
init?(exactly source: Float16)
Creates an integer from the given floating-point value, if it can be represented exactly.
init(from decoder: any Decoder) throws
static var bitWidth: Int { get }
The number of bits used for the underlying binary representation of values of this type.
var byteSwapped: Int { get }
var codingKey: any CodingKey { get }
var customMirror: Mirror { get }
A mirror that reflects the Int
instance.
var leadingZeroBitCount: Int { get }
The number of leading zeros in this value’s binary representation.
var magnitude: UInt { get }
var nonzeroBitCount: Int { get }
var trailingZeroBitCount: Int { get }
The number of trailing zeros in this value’s binary representation.
var words: Int.Words { get }
static func != (lhs: Int, rhs: Int) -> Bool
static func % (lhs: Int, rhs: Int) -> Int
static func %= (lhs: inout Int, rhs: Int)
static func & (lhs: Int, rhs: Int) -> Int
static func &<< (lhs: Int, rhs: Int) -> Int
static func &<<= (lhs: inout Int, rhs: Int)
static func &= (lhs: inout Int, rhs: Int)
static func &>> (lhs: Int, rhs: Int) -> Int
static func &>>= (lhs: inout Int, rhs: Int)
static func * (lhs: Int, rhs: Int) -> Int
Multiplies two values and produces their product.
static func *= (lhs: inout Int, rhs: Int)
Multiplies two values and stores the result in the left-hand-side variable.
static func + (lhs: Int, rhs: Int) -> Int
Adds two values and produces their sum.
static func += (lhs: inout Int, rhs: Int)
Adds two values and stores the result in the left-hand-side variable.
static func - (lhs: Int, rhs: Int) -> Int
Subtracts one value from another and produces their difference.
static func -= (lhs: inout Int, rhs: Int)
Subtracts the second value from the first and stores the difference in the left-hand-side variable.
static func / (lhs: Int, rhs: Int) -> Int
static func /= (lhs: inout Int, rhs: Int)
static func < (lhs: Int, rhs: Int) -> Bool
static func <= (lhs: Int, rhs: Int) -> Bool
static func == (lhs: Int, rhs: Int) -> Bool
static func > (lhs: Int, rhs: Int) -> Bool
static func >= (lhs: Int, rhs: Int) -> Bool
static func ^ (lhs: Int, rhs: Int) -> Int
static func ^= (lhs: inout Int, rhs: Int)
static func | (lhs: Int, rhs: Int) -> Int
static func |= (lhs: inout Int, rhs: Int)
func addingReportingOverflow(_ other: Int) -> (partialValue: Int, overflow: Bool)
func advanced(by n: Int) -> Int
Returns a value that is offset the specified distance from this value.
func distance(to other: Int) -> Int
Returns the distance from this value to the given value, expressed as a stride.
func dividedReportingOverflow(by other: Int) -> (partialValue: Int, overflow: Bool)
func dividingFullWidth(_ dividend: (high: Int, low: Int.Magnitude)) -> (quotient: Int, remainder: Int)
Returns a tuple containing the quotient and remainder of dividing the given value by this value.
func encode(to encoder: any Encoder) throws
Encodes this value into the given encoder.
func hash(into hasher: inout Hasher)
Hashes the essential components of this value by feeding them into the given hasher.
func multipliedFullWidth(by other: Int) -> (high: Int, low: Int.Magnitude)
Returns a tuple containing the high and low parts of the result of multiplying this value by the given value.
func multipliedReportingOverflow(by other: Int) -> (partialValue: Int, overflow: Bool)
func remainderReportingOverflow(dividingBy other: Int) -> (partialValue: Int, overflow: Bool)
func signum() -> Int
func subtractingReportingOverflow(_ other: Int) -> (partialValue: Int, overflow: Bool)
@frozen struct SIMD16Storage
Storage for a vector of 16 integers.
@frozen struct SIMD2Storage
Storage for a vector of two integers.
@frozen struct SIMD32Storage
Storage for a vector of 32 integers.
@frozen struct SIMD4Storage
Storage for a vector of four integers.
@frozen struct SIMD64Storage
Storage for a vector of 64 integers.
@frozen struct SIMD8Storage
Storage for a vector of eight integers.
@frozen struct Words
A type that represents the words of this integer.
typealias IntegerLiteralType = Int
A type that represents an integer literal.
typealias Magnitude = UInt
A type that can represent the absolute value of any possible value of this type.
typealias SIMDMaskScalar = Int
var customPlaygroundQuickLook: _PlaygroundQuickLook { get }
A custom playground Quick Look for the Int
instance.
init()
Creates a new value equal to zero.
init<T>(_ source: T) where T : BinaryInteger
Creates a new instance from the given integer.
init?(_ description: String)
Creates a new integer value from the given string.
init<T>(_ source: T) where T : BinaryFloatingPoint
Creates an integer from the given floating-point value, rounding toward zero. Any fractional part of the value passed as source
is removed.
init?<S>(_ text: S, radix: Int = 10) where S : StringProtocol
Creates a new integer value from the given string and radix.
init(bigEndian value: Self)
Creates an integer from its big-endian representation, changing the byte order if necessary.
init<Other>(clamping source: Other) where Other : BinaryInteger
Creates a new instance with the representable value that’s closest to the given integer.
init?<T>(exactly source: T) where T : BinaryInteger
Creates a new instance from the given integer, if it can be represented exactly.
init?<T>(exactly source: T) where T : BinaryFloatingPoint
Creates an integer from the given floating-point value, if it can be represented exactly.
init(integerLiteral value: Self)
init(littleEndian value: Self)
Creates an integer from its little-endian representation, changing the byte order if necessary.
init<T>(truncatingIfNeeded source: T) where T : BinaryInteger
Creates a new instance from the bit pattern of the given instance by truncating or sign-extending if needed to fit this type.
static var isSigned: Bool { get }
A Boolean value indicating whether this type is a signed integer type.
static var max: Self { get }
The maximum representable integer in this type.
static var min: Self { get }
The minimum representable integer in this type.
static var zero: Self { get }
The zero value.
static func random(in range: ClosedRange<Self>) -> Self
Returns a random value within the specified range.
static func random(in range: Range<Self>) -> Self
Returns a random value within the specified range.
static func random<T>(in range: ClosedRange<Self>, using generator: inout T) -> Self where T : RandomNumberGenerator
Returns a random value within the specified range, using the given generator as a source for randomness.
static func random<T>(in range: Range<Self>, using generator: inout T) -> Self where T : RandomNumberGenerator
Returns a random value within the specified range, using the given generator as a source for randomness.
var bigEndian: Self { get }
The big-endian representation of this integer.
var bitWidth: Int { get }
The number of bits in the binary representation of this value.
var description: String { get }
A textual representation of this value.
var littleEndian: Self { get }
The little-endian representation of this integer.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
static func != <Other>(lhs: Self, rhs: Other) -> Bool where Other : BinaryInteger
Returns a Boolean value indicating whether the two given values are not equal.
static func != (lhs: Self, rhs: Self) -> Bool
static func & (lhs: Self, rhs: Self) -> Self
Returns the result of performing a bitwise AND operation on the two given values.
static func &* (lhs: Self, rhs: Self) -> Self
static func &*= (lhs: inout Self, rhs: Self)
Multiplies two values and stores the result in the left-hand-side variable, wrapping any overflow.
static func &+ (lhs: Self, rhs: Self) -> Self
Returns the sum of the two given values, wrapping the result in case of any overflow.
static func &+= (lhs: inout Self, rhs: Self)
Adds two values and stores the result in the left-hand-side variable, wrapping any overflow.
static func &- (lhs: Self, rhs: Self) -> Self
Returns the difference of the two given values, wrapping the result in case of any overflow.
static func &-= (lhs: inout Self, rhs: Self)
Subtracts the second value from the first and stores the difference in the left-hand-side variable, wrapping any overflow.
static func &<< <Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger
Returns the result of shifting a value’s binary representation the specified number of digits to the left, masking the shift amount to the type’s bit width.
static func &<< (lhs: Self, rhs: Self) -> Self
Returns the result of shifting a value’s binary representation the specified number of digits to the left, masking the shift amount to the type’s bit width.
static func &<<= <Other>(lhs: inout Self, rhs: Other) where Other : BinaryInteger
Returns the result of shifting a value’s binary representation the specified number of digits to the left, masking the shift amount to the type’s bit width, and stores the result in the left-hand-side variable.
static func &>> <Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger
Returns the result of shifting a value’s binary representation the specified number of digits to the right, masking the shift amount to the type’s bit width.
static func &>> (lhs: Self, rhs: Self) -> Self
Returns the result of shifting a value’s binary representation the specified number of digits to the right, masking the shift amount to the type’s bit width.
static func &>>= <Other>(lhs: inout Self, rhs: Other) where Other : BinaryInteger
Calculates the result of shifting a value’s binary representation the specified number of digits to the right, masking the shift amount to the type’s bit width, and stores the result in the left-hand-side variable.
static func + (x: Self) -> Self
Returns the given number unchanged.
static func += (lhs: inout Self, rhs: Self)
static func - (operand: Self) -> Self
Returns the additive inverse of the specified value.
static func -= (lhs: inout Self, rhs: Self)
static func ... (minimum: Self) -> PartialRangeFrom<Self>
Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self) -> PartialRangeThrough<Self>
Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self>
Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self) -> PartialRangeUpTo<Self>
Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self) -> Range<Self>
Returns a half-open range that contains its lower bound but not its upper bound.
static func < (x: Self, y: Self) -> Bool
static func < <Other>(lhs: Self, rhs: Other) -> Bool where Other : BinaryInteger
Returns a Boolean value indicating whether the value of the first argument is less than that of the second argument.
static func << <RHS>(lhs: Self, rhs: RHS) -> Self where RHS : BinaryInteger
Returns the result of shifting a value’s binary representation the specified number of digits to the left.
static func << <Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger
Returns the result of shifting a value’s binary representation the specified number of digits to the left.
static func <<= <Other>(lhs: inout Self, rhs: Other) where Other : BinaryInteger
static func <= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func <= <Other>(lhs: Self, rhs: Other) -> Bool where Other : BinaryInteger
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func <= (lhs: Self, rhs: Self) -> Bool
static func == (x: Self, y: Self) -> Bool
static func == <Other>(lhs: Self, rhs: Other) -> Bool where Other : BinaryInteger
Returns a Boolean value indicating whether the two given values are equal.
static func > (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > <Other>(lhs: Self, rhs: Other) -> Bool where Other : BinaryInteger
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func > (lhs: Self, rhs: Self) -> Bool
static func >= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func >= <Other>(lhs: Self, rhs: Other) -> Bool where Other : BinaryInteger
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.
static func >= (lhs: Self, rhs: Self) -> Bool
static func >> <RHS>(lhs: Self, rhs: RHS) -> Self where RHS : BinaryInteger
Returns the result of shifting a value’s binary representation the specified number of digits to the right.
static func >> <Other>(lhs: Self, rhs: Other) -> Self where Other : BinaryInteger
Returns the result of shifting a value’s binary representation the specified number of digits to the right.
static func >>= <Other>(lhs: inout Self, rhs: Other) where Other : BinaryInteger
static func ^ (lhs: Self, rhs: Self) -> Self
Returns the result of performing a bitwise XOR operation on the two given values.
static func | (lhs: Self, rhs: Self) -> Self
Returns the result of performing a bitwise OR operation on the two given values.
static func ~ (x: Self) -> Self
Returns the inverse of the bits set in the argument.
func isMultiple(of other: Self) -> Bool
mutating func negate()
Replaces this value with its additive inverse.
func quotientAndRemainder(dividingBy rhs: Self) -> (quotient: Self, remainder: Self)
Returns the quotient and remainder of this value divided by the given value.
import Synchronization
protocol AtomicRepresentable
A type that supports atomic operations through a separate atomic storage representation.
static func decodeAtomicRepresentation(_ representation: consuming Int.AtomicRepresentation) -> Int
static func encodeAtomicRepresentation(_ value: borrowing Int) -> Int.AtomicRepresentation
typealias AtomicRepresentation
import Foundation
init(_ value: CGFloat)
init?(exactly number: NSNumber)
init(truncating number: NSNumber)
init(_ number: NSNumber)
init(_ value: String, format: IntegerFormatStyle<Self>.Percent, lenient: Bool = true) throws
init(_ value: String, format: IntegerFormatStyle<Self>.Currency, lenient: Bool = true) throws
init(_ value: String, format: IntegerFormatStyle<Self>, lenient: Bool = true) throws
init<S>(_ value: S.ParseInput, strategy: S) throws where S : ParseStrategy, S.ParseOutput : BinaryInteger
Initialize an instance by parsing value
with the given strategy
.
init<S>(_ value: S.ParseInput, strategy: S) throws where Self == S.ParseOutput, S : ParseStrategy
func formatted() -> String
Format self
using IntegerFormatStyle()
func formatted<S>(_ format: S) -> S.FormatOutput where S : FormatStyle, S.FormatInput : BinaryInteger
Format self
with the given format. self
is first converted to S.FormatInput
type, then format with the given format.
func formatted<S>(_ format: S) -> S.FormatOutput where Self == S.FormatInput, S : FormatStyle
Format self
with the given format.
import Benchmark
Benchmark allows you to easily create sophisticated Swift performance benchmarks
static func count(_ value: Int) -> Int
static func count(_ value: UInt) -> Int
static func giga(_ value: Int) -> Int
static func hours(_ hours: Int) -> Int
static func kilo(_ value: Int) -> Int
static func mega(_ value: Int) -> Int
static func microseconds(_ microseconds: Int) -> Int
static func milliseconds(_ milliseconds: Int) -> Int
static func minutes(_ minutes: Int) -> Int
static func nanoseconds(_ value: Int) -> Int
static func nanoseconds(_ value: UInt) -> Int
static func seconds(_ seconds: Int) -> Int
import SwiftASN1
An implementation of ASN.1 types and DER serialization.
protocol ASN1IntegerRepresentable : BERImplicitlyTaggable
A protocol that represents any internal object that can present itself as an INTEGER, or be parsed from an INTEGER.
protocol BERImplicitlyTaggable : BERParseable, BERSerializable, DERImplicitlyTaggable
protocol BERParseable : DERParseable
Defines a type that can be parsed from a BER-encoded form, which is a superset of DER.
protocol BERSerializable : DERSerializable
Defines a type that can be serialized in BER-encoded form.
protocol DERImplicitlyTaggable : DERParseable, DERSerializable
An ASN.1 node that can tolerate having an implicit tag.
protocol DERParseable
Defines a type that can be parsed from a DER-encoded form.
protocol DERSerializable
Defines a type that can be serialized in DER-encoded form.
init(asn1Any: ASN1Any) throws
Construct this node from an ASN.1 ANY object.
init(asn1Any: ASN1Any, withIdentifier identifier: ASN1Identifier) throws
Construct this node from an ASN.1 ANY object.
init(berASN1Any: ASN1Any) throws
Construct this node from an ASN.1 ANY object.
init(berASN1Any: ASN1Any, withIdentifier identifier: ASN1Identifier) throws
Construct this node from an ASN.1 ANY object.
init(berEncoded sequenceNodeIterator: inout ASN1NodeCollection.Iterator) throws
init(berEncoded node: ASN1Node) throws
By default, uses the underlying DERParseable initializer.
init(berEncoded: [UInt8]) throws
Initialize this object from a serialized BER representation.
init(berEncoded: ArraySlice<UInt8>) throws
Initialize this object from a serialized BER representation.
init(berEncoded: ASN1Node) throws
Initialize this object from a serialized BER representation.
init(berEncoded node: ASN1Node, withIdentifier identifier: ASN1Identifier) throws
init(berEncoded sequenceNodeIterator: inout ASN1NodeCollection.Iterator, withIdentifier identifier: ASN1Identifier = Self.defaultIdentifier) throws
Initialize this object as one element of a constructed ASN.1 object.
init(berEncoded: [UInt8], withIdentifier identifier: ASN1Identifier = Self.defaultIdentifier) throws
Initialize this object from a serialized BER representation.
init(berEncoded: ArraySlice<UInt8>, withIdentifier identifier: ASN1Identifier = Self.defaultIdentifier) throws
Initialize this object from a serialized BER representation.
init(berIntegerBytes bytes: ArraySlice<UInt8>) throws
init(derEncoded sequenceNodeIterator: inout ASN1NodeCollection.Iterator) throws
Initialize this object as one element of a constructed ASN.1 object.
init(derEncoded: [UInt8]) throws
Initialize this object from a serialized DER representation.
init(derEncoded: ArraySlice<UInt8>) throws
Initialize this object from a serialized DER representation.
init(derEncoded: ASN1Node) throws
init(derEncoded node: ASN1Node, withIdentifier identifier: ASN1Identifier) throws
init(derEncoded sequenceNodeIterator: inout ASN1NodeCollection.Iterator, withIdentifier identifier: ASN1Identifier = Self.defaultIdentifier) throws
Initialize this object as one element of a constructed ASN.1 object.
init(derEncoded: [UInt8], withIdentifier identifier: ASN1Identifier = Self.defaultIdentifier) throws
Initialize this object from a serialized DER representation.
init(derEncoded: ArraySlice<UInt8>, withIdentifier identifier: ASN1Identifier = Self.defaultIdentifier) throws
Initialize this object from a serialized DER representation.
init(derIntegerBytes bytes: ArraySlice<UInt8>) throws
static var defaultIdentifier: ASN1Identifier { get }
func serialize(into coder: inout DER.Serializer) throws
func serialize(into coder: inout DER.Serializer, withIdentifier identifier: ASN1Identifier) throws
func withBigEndianIntegerBytes<ReturnType>(_ body: (IntegerBytesCollection<Self>) throws -> ReturnType) rethrows -> ReturnType
import NIOConcurrencyHelpers
@preconcurrency protocol AtomicPrimitive
@preconcurrency protocol NIOAtomicPrimitive
static let atomic_add: (OpaquePointer, Int) -> Int
static let atomic_compare_and_exchange: (OpaquePointer, Int, Int) -> Bool
static let atomic_create: (Int) -> OpaquePointer
static let atomic_destroy: (OpaquePointer) -> Void
static let atomic_exchange: (OpaquePointer, Int) -> Int
static let atomic_load: (OpaquePointer) -> Int
static let atomic_store: (OpaquePointer, Int) -> Void
static let atomic_sub: (OpaquePointer, Int) -> Int
static let nio_atomic_add: (UnsafeMutablePointer<catmc_nio_atomic_long>, Int) -> Int
static let nio_atomic_compare_and_exchange: (UnsafeMutablePointer<catmc_nio_atomic_long>, Int, Int) -> Bool
static let nio_atomic_create_with_existing_storage: (UnsafeMutablePointer<catmc_nio_atomic_long>, Int) -> Void
static let nio_atomic_exchange: (UnsafeMutablePointer<catmc_nio_atomic_long>, Int) -> Int
static let nio_atomic_load: (UnsafeMutablePointer<catmc_nio_atomic_long>) -> Int
static let nio_atomic_store: (UnsafeMutablePointer<catmc_nio_atomic_long>, Int) -> Void
static let nio_atomic_sub: (UnsafeMutablePointer<catmc_nio_atomic_long>, Int) -> Int
typealias AtomicWrapper = catmc_nio_atomic_long
import NIOWebSocket
init(webSocketOpcode opcode: WebSocketOpcode)
Create a UInt8 corresponding to the integer value for a given WebSocketOpcode
.
import NIOHTTP2
This project contains HTTP/2 support for Swift projects using SwiftNIO.
init(_ http2StreamID: HTTP2StreamID)
Create an Int holding the integer value of this streamID.
init(http2ErrorCode code: HTTP2ErrorCode)
Create an integer corresponding to the given HTTP2ErrorCode
.
import SwiftSyntaxBuilder
SwiftSyntaxBuilder is a tool for generating Swift code in a convenient way using result builders.
protocol ExpressibleByLiteralSyntax
A Swift type whose value can be represented directly in source code by a Swift literal.
func makeLiteralSyntax() -> IntegerLiteralExprSyntax
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
protocol AsyncRequestDecodable
Can convert Request
to a Self
.
protocol AsyncResponseEncodable
Can convert self
to a Response
.
protocol Content : Decodable, Encodable, AsyncRequestDecodable, AsyncResponseEncodable, RequestDecodable, ResponseEncodable
Convertible to / from content in an HTTP message.
protocol RequestDecodable
Can convert Request
to a Self
.
protocol ResponseEncodable
Can convert self
to a Response
.
static var defaultContentType: HTTPMediaType { get }
static func decodeRequest(_ request: Request) -> EventLoopFuture<Self>
static func decodeRequest(_ request: Request) async throws -> Self
mutating func afterDecode() throws
mutating func beforeEncode() throws
func encodeResponse(for request: Request) -> EventLoopFuture<Response>
func encodeResponse(status: HTTPStatus, headers: HTTPHeaders = [:], for request: Request) -> EventLoopFuture<Response>
Asynchronously encodes Self
into a Response
, setting the supplied status and headers.