Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move RESP3TokenDecoder into its own file #75

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions Sources/RESP3/RESP3Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -515,16 +515,3 @@ extension UInt32 {
}()
}

public struct RESP3TokenDecoder: NIOSingleStepByteToMessageDecoder {
public typealias InboundOut = RESP3Token

public init() {}

public mutating func decode(buffer: inout ByteBuffer) throws -> RESP3Token? {
try RESP3Token(consuming: &buffer)
}

public mutating func decodeLast(buffer: inout ByteBuffer, seenEOF _: Bool) throws -> RESP3Token? {
try self.decode(buffer: &buffer)
}
}
29 changes: 29 additions & 0 deletions Sources/RESP3/RESP3TokenDecoder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the RediStack open source project
//
// Copyright (c) 2023 RediStack project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of RediStack project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import NIOCore

public struct RESP3TokenDecoder: NIOSingleStepByteToMessageDecoder {
public typealias InboundOut = RESP3Token

public init() {}

public mutating func decode(buffer: inout ByteBuffer) throws -> RESP3Token? {
try RESP3Token(consuming: &buffer)
}

public mutating func decodeLast(buffer: inout ByteBuffer, seenEOF _: Bool) throws -> RESP3Token? {
try self.decode(buffer: &buffer)
}
}