Skip to content

Commit 95b2d06

Browse files
authored
Move RESP3TokenDecoder into its own file (#75)
1 parent ae9f06b commit 95b2d06

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

Sources/RESP3/RESP3Token.swift

-13
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,3 @@ extension UInt32 {
515515
}()
516516
}
517517

518-
public struct RESP3TokenDecoder: NIOSingleStepByteToMessageDecoder {
519-
public typealias InboundOut = RESP3Token
520-
521-
public init() {}
522-
523-
public mutating func decode(buffer: inout ByteBuffer) throws -> RESP3Token? {
524-
try RESP3Token(consuming: &buffer)
525-
}
526-
527-
public mutating func decodeLast(buffer: inout ByteBuffer, seenEOF _: Bool) throws -> RESP3Token? {
528-
try self.decode(buffer: &buffer)
529-
}
530-
}

Sources/RESP3/RESP3TokenDecoder.swift

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the RediStack open source project
4+
//
5+
// Copyright (c) 2023 RediStack project authors
6+
// Licensed under Apache License v2.0
7+
//
8+
// See LICENSE.txt for license information
9+
// See CONTRIBUTORS.txt for the list of RediStack project authors
10+
//
11+
// SPDX-License-Identifier: Apache-2.0
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
import NIOCore
16+
17+
public struct RESP3TokenDecoder: NIOSingleStepByteToMessageDecoder {
18+
public typealias InboundOut = RESP3Token
19+
20+
public init() {}
21+
22+
public mutating func decode(buffer: inout ByteBuffer) throws -> RESP3Token? {
23+
try RESP3Token(consuming: &buffer)
24+
}
25+
26+
public mutating func decodeLast(buffer: inout ByteBuffer, seenEOF _: Bool) throws -> RESP3Token? {
27+
try self.decode(buffer: &buffer)
28+
}
29+
}

0 commit comments

Comments
 (0)