|
|
@@ -30,9 +30,7 @@
|
|
|
/// }
|
|
|
///
|
|
|
/// The actual functionality is implemented either in the generated code or in
|
|
|
-/// default implementations of the below methods and properties. Some of them,
|
|
|
-/// including `hashValue` and `debugDescription`, are designed to let you
|
|
|
-/// override the functionality in custom extensions to the generated code.
|
|
|
+/// default implementations of the below methods and properties.
|
|
|
public protocol Message: CustomDebugStringConvertible {
|
|
|
/// Creates a new message with all of its fields initialized to their default
|
|
|
/// values.
|
|
|
@@ -108,11 +106,6 @@ public protocol Message: CustomDebugStringConvertible {
|
|
|
/// with the `Hashable` protocol.
|
|
|
var hashValue: Int { get }
|
|
|
|
|
|
- /// A textual representation of this message's contents suitable for
|
|
|
- /// debugging, for conformance with the `CustomDebugStringConvertible`
|
|
|
- /// protocol.
|
|
|
- var debugDescription: String { get }
|
|
|
-
|
|
|
/// Helper to compare `Message`s when not having a specific type to use
|
|
|
/// normal `Equatable`. `Equatable` is provided with specific generated
|
|
|
/// types.
|
|
|
@@ -129,13 +122,7 @@ public extension Message {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
- /// A hash based on the message's full contents. Can be overridden
|
|
|
- /// to improve performance and/or remove some values from being used for the
|
|
|
- /// hash.
|
|
|
- ///
|
|
|
- /// If you override this, make sure you maintain the property that values
|
|
|
- /// which are `==` to each other have identical `hashValues`, providing a
|
|
|
- /// custom implementation of `==` if necessary.
|
|
|
+ /// A hash based on the message's full contents.
|
|
|
var hashValue: Int {
|
|
|
var visitor = HashVisitor()
|
|
|
try? traverse(visitor: &visitor)
|
|
|
@@ -143,8 +130,7 @@ public extension Message {
|
|
|
}
|
|
|
|
|
|
/// A description generated by recursively visiting all fields in the message,
|
|
|
- /// including messages. May be overridden to improve readability and/or
|
|
|
- /// performance.
|
|
|
+ /// including messages.
|
|
|
var debugDescription: String {
|
|
|
// TODO Ideally there would be something like serializeText() that can
|
|
|
// take a prefix so we could do something like:
|