Skip to content

Commit

Permalink
Remove the bridging method without BinaryEncodingOptions.
Browse files Browse the repository at this point in the history
Since `main` is going to be 2.0, it is accepting breaking changes, so we don't
need to keep the shim without the argument, we can just have the newer signature
with the default provided there.
  • Loading branch information
thomasvl committed Oct 27, 2023
1 parent 399023c commit b18d5e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
18 changes: 1 addition & 17 deletions Sources/SwiftProtobuf/Message+BinaryAdditions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@ import Foundation

/// Binary encoding and decoding methods for messages.
extension Message {
/// Returns a `SwiftProtobufContiguousBytes` instance containing the Protocol Buffer binary
/// format serialization of the message.
///
/// - Parameters:
/// - partial: If `false` (the default), this method will check
/// `Message.isInitialized` before encoding to verify that all required
/// fields are present. If any are missing, this method throws.
/// `BinaryEncodingError.missingRequiredFields`.
/// - Returns: A `SwiftProtobufContiguousBytes` instance containing the binary serialization
/// of the message.
///
/// - Throws: `BinaryEncodingError` if encoding fails.
public func serializedBytes<Bytes: SwiftProtobufContiguousBytes>(partial: Bool = false) throws -> Bytes {
try serializedBytes(partial: partial, options: BinaryEncodingOptions())
}

/// Returns a `SwiftProtobufContiguousBytes` instance containing the Protocol Buffer binary
/// format serialization of the message.
///
Expand All @@ -47,7 +31,7 @@ extension Message {
/// - Throws: `BinaryEncodingError` if encoding fails.
public func serializedBytes<Bytes: SwiftProtobufContiguousBytes>(
partial: Bool = false,
options: BinaryEncodingOptions
options: BinaryEncodingOptions = BinaryEncodingOptions()
) throws -> Bytes {
if !partial && !isInitialized {
throw BinaryEncodingError.missingRequiredFields
Expand Down
16 changes: 1 addition & 15 deletions Sources/SwiftProtobuf/Message+BinaryAdditions_Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,6 @@ extension Message {
try merge(serializedBytes: data, extensions: extensions, partial: partial, options: options)
}

/// Returns a `Data` instance containing the Protocol Buffer binary
/// format serialization of the message.
///
/// - Parameters:
/// - partial: If `false` (the default), this method will check
/// `Message.isInitialized` before encoding to verify that all required
/// fields are present. If any are missing, this method throws
/// `BinaryEncodingError.missingRequiredFields`.
/// - Returns: A `Data` instance containing the binary serialization of the message.
/// - Throws: `BinaryEncodingError` if encoding fails.
public func serializedData(partial: Bool = false) throws -> Data {
try serializedBytes(partial: partial, options: BinaryEncodingOptions())
}

/// Returns a `Data` instance containing the Protocol Buffer binary
/// format serialization of the message.
///
Expand All @@ -97,7 +83,7 @@ extension Message {
/// - Throws: `BinaryEncodingError` if encoding fails.
public func serializedData(
partial: Bool = false,
options: BinaryEncodingOptions
options: BinaryEncodingOptions = BinaryEncodingOptions()
) throws -> Data {
try serializedBytes(partial: partial, options: options)
}
Expand Down

0 comments on commit b18d5e6

Please sign in to comment.