funcmike / rabbitmq-nio

A Swift implementation of AMQP 0.9.1 protocol: decoder + encoder and non-blocking client
Apache License 2.0
44 stars 8 forks source link

Refactor Protocol Frame Enum to Struct with channelID property #17

Closed funcmike closed 1 year ago

funcmike commented 1 year ago

From

    public typealias ChannelID = UInt16

    case method(ChannelID, Method)
    case header(ChannelID, Header)
    case body(ChannelID, body: ByteBuffer)
    case heartbeat(ChannelID)
}

To

public struct Frame: PayloadDecodable, PayloadEncodable {
    var channelID: ChannelID

    var payload: Payload

    enum Payload {
        case method(Method)
        case header(Header)
        case body(ByteBuffer)
        case heartbeat
    }
}