Skip to content

Commit

Permalink
Merge branch 'main' into mmbm-shared-benchmark-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiBM authored Jan 16, 2025
2 parents 4ea418c + 48c1058 commit c2e0e5d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Benchmarks/Parser/AsyncSyncSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class AsyncSyncSequence<Base: Sequence>: AsyncSequence {
}

func makeAsyncIterator() -> Iterator {
defer { self.base = nil } // release the reference so no CoW is triggered
defer { self.base = nil } // release the reference so no CoW is triggered
return Iterator(base.unsafelyUnwrapped.makeIterator())
}
}
2 changes: 1 addition & 1 deletion Sources/MultipartKit/MultipartFormData.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Collections
import Foundation

enum MultipartFormData<Body: MultipartPartBodyElement>: Equatable, Sendable {
enum MultipartFormData<Body: MultipartPartBodyElement>: Sendable {
typealias Keyed = OrderedDictionary<String, MultipartFormData>

case single(MultipartPart<Body>)
Expand Down
4 changes: 2 additions & 2 deletions Sources/MultipartKit/MultipartPart.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import HTTPTypes

public typealias MultipartPartBodyElement = Collection<UInt8> & Equatable & Sendable
public typealias MultipartPartBodyElement = Collection<UInt8> & Sendable

/// Represents a single part of a multipart-encoded message.
public struct MultipartPart<Body: MultipartPartBodyElement>: Equatable, Sendable {
public struct MultipartPart<Body: MultipartPartBodyElement>: Sendable {
/// The header fields for this part.
public var headerFields: HTTPFields

Expand Down
2 changes: 1 addition & 1 deletion Sources/MultipartKit/MultipartSection.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HTTPTypes

public enum MultipartSection<Body: MultipartPartBodyElement>: Equatable, Sendable {
public enum MultipartSection<Body: MultipartPartBodyElement>: Sendable {
case headerFields(HTTPFields)
case bodyChunk(Body)
case boundary(end: Bool)
Expand Down
16 changes: 16 additions & 0 deletions Tests/MultipartKitTests/Utilities/MultipartSection+Equatable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import MultipartKit

extension MultipartSection: Equatable where Body: Equatable {
public static func == (lhs: MultipartKit.MultipartSection<Body>, rhs: MultipartKit.MultipartSection<Body>) -> Bool {
switch (lhs, rhs) {
case let (.headerFields(lhsFields), .headerFields(rhsFields)):
lhsFields == rhsFields
case let (.bodyChunk(lhsChunk), .bodyChunk(rhsChunk)):
lhsChunk == rhsChunk
case (.boundary, .boundary):
true
default:
false
}
}
}

0 comments on commit c2e0e5d

Please sign in to comment.