Element
Metadata.swift:266typealias Element = (key: String, value: Value)
typealias Element = (key: String, value: Value)
import GRPCCore
A gRPC library for Swift written natively in Swift.
struct Metadata
A collection of metadata key-value pairs, found in RPC streams.
@frozen struct String
A Unicode string value that is a collection of characters.
enum Value
A metadata value. It can either be a simple string, or binary data.
init()
Initialize an empty Metadata collection.
init(_ elements: some Sequence<Element>)
Initialize Metadata
from a Sequence
of Element
s.
init(arrayLiteral elements: (String, Value)...)
init(dictionaryLiteral elements: (String, Value)...)
var capacity: Int { get }
The Metadata collection’s capacity.
var description: String { get }
var endIndex: Index { get }
var startIndex: Index { get }
subscript(key: String) -> Values { get }
Get a Values
sequence for a given key.
subscript(position: Index) -> Element { get }
subscript(binaryValues key: String) -> BinaryValues { get }
A subscript to get a BinaryValues
sequence for a given key.
subscript(stringValues key: String) -> StringValues { get }
Get a StringValues
sequence for a given key.
mutating func add(contentsOf other: Metadata)
Add the contents of another Metadata
to this instance.
mutating func add(contentsOf other: some Sequence<Element>)
Add the contents of a Sequence
of key-value pairs to this Metadata
instance.
mutating func addBinary(_ binaryValue: [UInt8], forKey key: String)
Add a new key-value pair, where the value is binary data, in the form of [UInt8]
.
mutating func addString(_ stringValue: String, forKey key: String)
Add a new key-value pair, where the value is a string.
func index(after i: Index) -> Index
func index(before i: Index) -> Index
mutating func removeAll(keepingCapacity: Bool)
Removes all key-value pairs from this metadata instance.
mutating func removeAll(where predicate: (_ key: String, _ value: Value) throws -> Bool) rethrows
Removes all elements which match the given predicate.
mutating func removeAllValues(forKey key: String)
Removes all values associated with the given key.
mutating func replaceOrAddBinary(_ binaryValue: [UInt8], forKey key: String)
Adds a key-value pair to the collection, where the value is [UInt8]
.
mutating func replaceOrAddString(_ stringValue: String, forKey key: String)
Adds a key-value pair to the collection, where the value is a string.
mutating func reserveCapacity(_ minimumCapacity: Int)
Reserve the specified minimum capacity in the collection.
struct BinaryValues
A sequence of metadata binary values for a given key.
struct Index
struct StringValues
A sequence of metadata string values for a given key.
struct Values
A sequence of metadata values for a given key.