From 879f0789da8c8009761d1cc1603749fab29e2e95 Mon Sep 17 00:00:00 2001 From: Dimitri Bouniol Date: Sat, 5 Mar 2022 11:34:13 -0800 Subject: [PATCH] Fixed a compilation issue due to a misplaced async --- Sources/Bytes/Integer.swift | 2 +- Sources/Bytes/RawRepresentable.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Bytes/Integer.swift b/Sources/Bytes/Integer.swift index dd9f0a2..02da264 100644 --- a/Sources/Bytes/Integer.swift +++ b/Sources/Bytes/Integer.swift @@ -148,7 +148,7 @@ extension IteratorProtocol where Element == Byte { /// - Returns: An integer of type `type`, or `nil` if the sequence is finished. /// - Throws: `BytesError.invalidMemorySize` if a complete integer could not be returned by the time the sequence ended. @inlinable - public mutating func nextIfPresent(bigEndian type: T.Type) async throws -> T? { + public mutating func nextIfPresent(bigEndian type: T.Type) throws -> T? { try nextIfPresent(bytes: Bytes.self, count: MemoryLayout.size).map { try T(bigEndianBytes: $0) } } } diff --git a/Sources/Bytes/RawRepresentable.swift b/Sources/Bytes/RawRepresentable.swift index 31d498d..4588b5c 100644 --- a/Sources/Bytes/RawRepresentable.swift +++ b/Sources/Bytes/RawRepresentable.swift @@ -287,7 +287,7 @@ extension IteratorProtocol where Element == Byte { /// - Returns: A raw representable type as a fixed width integer of type `type`, or `nil` if the sequence is finished. /// - Throws: `BytesError.invalidMemorySize` if a complete integer could not be returned by the time the sequence ended. @inlinable - public mutating func nextIfPresent(bigEndian type: T.Type) async throws -> T? where T.RawValue: FixedWidthInteger { + public mutating func nextIfPresent(bigEndian type: T.Type) throws -> T? where T.RawValue: FixedWidthInteger { try nextIfPresent(bytes: Bytes.self, count: MemoryLayout.size).map { try T(bigEndianBytes: $0) } } }