Make Capability and its subtypes Hashable (#473)

This commit is contained in:
Matt Diephouse authored and GitHub committed 2021-03-10 17:06:03 +00:00
1 parent a2d4eb2fae
commit 8296db95dd
1 file changed
+8 -8
+8 -8
View File
@@ -17,7 +17,7 @@ import struct NIO.ByteBuffer
/// A `Capability` is advertised as a piece of functionality that a server supports. If the
/// server does not explicitly advertise a capability then the client should not assume the functionality
/// is present.
public struct Capability: Equatable {
public struct Capability: Hashable {
/// The raw string value of the capability.
public var rawValue: String
private var splitIndex: String.Index?
@@ -60,7 +60,7 @@ public struct Capability: Equatable {
extension Capability {
/// The method to use when authenticating a user.
public struct AuthKind: Equatable {
public struct AuthKind: Hashable {
/// Use a token generated by a specified algorithm.
public static let token = Self(unchecked: "TOKEN")
@@ -94,7 +94,7 @@ extension Capability {
}
/// Wraps supported contexts including *SEARCH* and *SORT*.
public struct ContextKind: Equatable {
public struct ContextKind: Hashable {
/// Support extended search commands and accepts new return options.
public static let search = Self(unchecked: "SEARCH")
@@ -116,7 +116,7 @@ extension Capability {
}
/// Wraps *SORT=* extensions.
public struct SortKind: Equatable {
public struct SortKind: Hashable {
/// A server that supports the full SORT extension as well as both the
/// DISPLAYFROM and DISPLAYTO sort criteria indicates this by returning
/// "SORT=DISPLAY" in its CAPABILITY response.
@@ -137,7 +137,7 @@ extension Capability {
}
/// Wraps *THREAD=* extensions.
public struct ThreadKind: Equatable {
public struct ThreadKind: Hashable {
/// The searched messages are sorted by base subject and then
/// by the sent date. The messages are then split into separate
/// threads, with each thread containing messages with the same
@@ -164,7 +164,7 @@ extension Capability {
}
/// Wraps *STATUS=* extensions.
public struct StatusKind: Equatable {
public struct StatusKind: Hashable {
/// Allows retrieving the total storage size of a mailbox with
/// a single STATUS command rather than retrieving and
/// summing the sizes of all individual messages in that mailbox.
@@ -185,7 +185,7 @@ extension Capability {
}
/// Wraps *UTF8=* extensions
public struct UTF8Kind: Equatable {
public struct UTF8Kind: Hashable {
/// Enabling this extension will tell the server that the client accepts
/// UTF8-encoded strings.
public static let accept = Self(unchecked: "ACCEPT")
@@ -206,7 +206,7 @@ extension Capability {
/// Wraps *RIGHTS=* extensions. For more information on what each
/// letter means see RFC 4314 section 4.
public struct RightsKind: Equatable {
public struct RightsKind: Hashable {
/// Allowed operations in auth state: *DELETE*, *APPEND*, *CREATE*, *RENAME*,
/// Allowed operations in selected state: *COPY*, *STORE flags*, *EXPUNGE* (required)
public static let tekx = Self(unchecked: "TEKX")