Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Sources/NIOCore/ByteBuffer-quicBinaryEncodingStrategy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ extension ByteBuffer {
/// Calculates the minimum number of bytes needed to encode an integer using this strategy
/// - Parameter integer: The integer to be encoded
/// - Returns: The number of bytes needed to encode it
@inlinable
public static func bytesNeededForInteger<IntegerType: FixedWidthInteger>(_ integer: IntegerType) -> Int {
// We must cast the integer to UInt64 here
// Otherwise, an integer can fall through to the default case
Expand Down Expand Up @@ -129,17 +130,17 @@ extension ByteBuffer {
}

extension NIOBinaryIntegerEncodingStrategy where Self == ByteBuffer.QUICBinaryEncodingStrategy {
@inlinable
/// Encodes bytes as defined in RFC 9000 § 16
/// - Parameter requiredBytesHint: An estimate of the bytes required to write integers using this strategy. This parameter is only relevant if calling ``ByteBuffer/writeLengthPrefixed(strategy:writeData:)``
/// - Returns: An instance of ``ByteBuffer/QUICBinaryEncodingStrategy``
@inlinable
public static func quic(
requiredBytesHint: ByteBuffer.QUICBinaryEncodingStrategy.IntegerLength
) -> ByteBuffer.QUICBinaryEncodingStrategy {
ByteBuffer.QUICBinaryEncodingStrategy(requiredBytesHint: requiredBytesHint)
}

@inlinable
/// Encodes bytes as defined in RFC 9000 § 16
@inlinable
public static var quic: ByteBuffer.QUICBinaryEncodingStrategy { .quic(requiredBytesHint: .four) }
}
Loading