Skip to content

Commit

Permalink
Run swift format
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonicbyte committed Sep 3, 2024
1 parent 413edfd commit 58ad0ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Sources/NIOCore/ByteBuffer-hexdump.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension ByteBuffer {

/// A hex dump format compatible with `hexdump` command line utility.
public static let detailed = Self(.detailed(maxBytes: nil))

/// A hex dump analog to `plain` format but without whitespaces.
public static let compact = Self(.compact(maxBytes: nil))

Expand All @@ -47,7 +47,7 @@ extension ByteBuffer {
public static func detailed(maxBytes: Int) -> Self {
Self(.detailed(maxBytes: maxBytes))
}

/// A hex dump analog to `plain`format but without whitespaces.
/// This format will dump first `maxBytes / 2` bytes, and the last `maxBytes / 2` bytes, with a placeholder in between.
public static func compact(maxBytes: Int) -> Self {
Expand Down Expand Up @@ -105,14 +105,14 @@ extension ByteBuffer {

let startHex = front._hexDump(separateWithWhitespace: separateWithWhitespace)
let endHex = back._hexDump(separateWithWhitespace: separateWithWhitespace)

var dots: String
if separateWithWhitespace {
dots = " ... "
} else {
dots = "..."
}

return startHex + dots + endHex
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/NIOCoreTests/ByteBufferTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1904,7 +1904,7 @@ class ByteBufferTest: XCTestCase {
let expected = "00 01 02 03 04 ... fb fc fd fe ff"
XCTAssertEqual(expected, actual)
}

func testHexDumpCompact() {
let buf = ByteBuffer(string: "Hello")
XCTAssertEqual("48656c6c6f", buf.hexDump(format: .compact))
Expand Down

0 comments on commit 58ad0ba

Please sign in to comment.