Skip to content

Commit

Permalink
Move RESP3TokenDecoder into its own file (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfett authored Jul 6, 2023
1 parent ae9f06b commit 95b2d06
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
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)
}
}

0 comments on commit 95b2d06

Please sign in to comment.