Coverage Report

Created: 2026-04-29 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/swift-nio/Sources/NIOPosix/Utilities.swift
Line
Count
Source
1
//===----------------------------------------------------------------------===//
2
//
3
// This source file is part of the SwiftNIO open source project
4
//
5
// Copyright (c) 2017-2021 Apple Inc. and the SwiftNIO 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 SwiftNIO project authors
10
//
11
// SPDX-License-Identifier: Apache-2.0
12
//
13
//===----------------------------------------------------------------------===//
14
15
#if !os(WASI)
16
17
/// A utility function that runs the body code only in debug builds, without
18
/// emitting compiler warnings.
19
///
20
/// This is currently the only way to do this in Swift: see
21
/// https://forums.swift.org/t/support-debug-only-code/11037 for a discussion.
22
@inlinable
23
0
internal func debugOnly(_ body: () -> Void) {
24
0
    assert(
25
0
        {
26
0
            body()
27
0
            return true
28
0
        }()
Unexecuted instantiation: $s8NIOPosix9debugOnlyyyyyXEFSbyXEfu_
Unexecuted instantiation: $s8NIOPosix9debugOnlyyyyyXEFSbyXEfu_SbyXEfU_
29
0
    )
30
0
}
31
32
/// Allows to "box" another value.
33
final class Box<T> {
34
    let value: T
35
0
    init(_ value: T) { self.value = value }
36
}
37
#endif  // !os(WASI)