/src/swift-protobuf/Sources/SwiftProtobuf/BinaryEncodingOptions.swift
Line | Count | Source |
1 | | // Sources/SwiftProtobuf/BinaryEncodingOptions.swift - Binary encoding options |
2 | | // |
3 | | // Copyright (c) 2014 - 2023 Apple Inc. and the project authors |
4 | | // Licensed under Apache License v2.0 with Runtime Library Exception |
5 | | // |
6 | | // See LICENSE.txt for license information: |
7 | | // https://github.com/apple/swift-protobuf/blob/main/LICENSE.txt |
8 | | // |
9 | | // ----------------------------------------------------------------------------- |
10 | | /// |
11 | | /// Binary encoding options |
12 | | /// |
13 | | // ----------------------------------------------------------------------------- |
14 | | |
15 | | /// Options for binary encoding. |
16 | | public struct BinaryEncodingOptions: Sendable { |
17 | | /// Whether to use deterministic ordering when serializing. |
18 | | /// |
19 | | /// Note that the deterministic serialization is NOT canonical across languages. |
20 | | /// It is NOT guaranteed to remain stable over time. It is unstable across |
21 | | /// different builds with schema changes due to unknown fields. Users who need |
22 | | /// canonical serialization (e.g., persistent storage in a canonical form, |
23 | | /// fingerprinting, etc.) should define their own canonicalization specification |
24 | | /// and implement their own serializer rather than relying on this API. |
25 | | /// |
26 | | /// If deterministic serialization is requested, map entries will be sorted |
27 | | /// by keys in lexicographical order. This is an implementation detail |
28 | | /// and subject to change. |
29 | 1.80M | public var useDeterministicOrdering: Bool = false |
30 | | |
31 | 1.80M | public init() {} |
32 | | } |