Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Sendability annotiations #72

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 14 additions & 4 deletions Sources/SwiftASN1/ASN1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
//
//===----------------------------------------------------------------------===//


@available(*, unavailable)
extension ASN1: Sendable { }

public enum ASN1 {}

// MARK: - EncodingRules
extension ASN1 {
@usableFromInline
enum EncodingRules {
enum EncodingRules: Sendable {
case basic

case distinguished
Expand Down Expand Up @@ -124,7 +128,7 @@ extension ASN1.ParserNode {

extension ASN1 {
@usableFromInline
struct ParseResult {
struct ParseResult: Sendable {
@inlinable
static var _maximumNodeDepth: Int { 50 }

Expand Down Expand Up @@ -303,6 +307,12 @@ extension ASN1 {
}
}

@available(*, unavailable)
extension ASN1.LazySetOfSequence: Sendable {}

@available(*, unavailable)
extension ASN1.LazySetOfSequence.Iterator: Sendable {}

// MARK: - NodeCollection
/// Represents a collection of ASN.1 nodes contained in a constructed ASN.1 node.
///
Expand Down Expand Up @@ -333,7 +343,7 @@ extension ASN1NodeCollection: Sendable {}

extension ASN1NodeCollection: Sequence {
/// An iterator of ASN.1 nodes that are children of a specific constructed node.
public struct Iterator: IteratorProtocol {
public struct Iterator: IteratorProtocol, Sendable {
@usableFromInline
var _nodes: ArraySlice<ASN1.ParserNode>

Expand Down Expand Up @@ -427,7 +437,7 @@ extension ASN1Node {

extension ArraySlice where Element == UInt8 {
@usableFromInline
enum ASN1Length {
enum ASN1Length: Sendable {
case indefinite
case definite(_: UInt)
}
Expand Down
3 changes: 3 additions & 0 deletions Sources/SwiftASN1/BER.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
/// for BER encoding and decoding.
public enum BER {}

@available(*, unavailable)
extension BER: Sendable {}

// MARK: - Parser Node
extension BER {
@usableFromInline
Expand Down
12 changes: 12 additions & 0 deletions Sources/SwiftASN1/Basic ASN1 Types/ObjectIdentifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ extension ASN1ObjectIdentifier: CustomStringConvertible {
}
}

@available(*, unavailable)
extension ASN1ObjectIdentifier.NamedCurves: Sendable {}

@available(*, unavailable)
extension ASN1ObjectIdentifier.AlgorithmIdentifier: Sendable {}

@available(*, unavailable)
extension ASN1ObjectIdentifier.NameAttributes: Sendable {}

@available(*, unavailable)
extension ASN1ObjectIdentifier.OCSP: Sendable {}

extension ASN1ObjectIdentifier {
/// Represents a namespace for OIDs that identify named Elliptic Curves.
///
Expand Down
4 changes: 4 additions & 0 deletions Sources/SwiftASN1/Basic ASN1 Types/TimeUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
//
//===----------------------------------------------------------------------===//


@available(*, unavailable)
extension TimeUtilities: Sendable {}

@usableFromInline
enum TimeUtilities {
@inlinable
Expand Down
3 changes: 3 additions & 0 deletions Sources/SwiftASN1/DER.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
/// for DER encoding and decoding.
public enum DER {}

@available(*, unavailable)
extension DER: Sendable {}

// MARK: - Parser Node
extension DER {
@usableFromInline
Expand Down