Skip to content

Commit 603c916

Browse files
authored
Enable struct Spans with reference semantics; optimal NoopSpan (#94)
1 parent 7586bdc commit 603c916

13 files changed

+143
-206
lines changed

Sources/Tracing/NoOpTracer.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import Dispatch
1818

1919
/// Tracer that ignores all operations, used when no tracing is required.
2020
public struct NoOpTracer: LegacyTracerProtocol {
21-
public typealias Span = NoOpSpan
21+
public typealias TracerSpan = NoOpSpan
2222

2323
public init() {}
2424

@@ -28,7 +28,7 @@ public struct NoOpTracer: LegacyTracerProtocol {
2828
at time: DispatchWallTime,
2929
function: String,
3030
file fileID: String,
31-
line: UInt) -> any SpanProtocol
31+
line: UInt) -> any Span
3232
{
3333
NoOpSpan(baggage: baggage())
3434
}
@@ -47,7 +47,7 @@ public struct NoOpTracer: LegacyTracerProtocol {
4747
// no-op
4848
}
4949

50-
public final class NoOpSpan: SpanProtocol {
50+
public struct NoOpSpan: Span {
5151
public let baggage: Baggage
5252
public var isRecording: Bool {
5353
false
@@ -57,7 +57,7 @@ public struct NoOpTracer: LegacyTracerProtocol {
5757
get {
5858
"noop"
5959
}
60-
set {
60+
nonmutating set {
6161
// ignore
6262
}
6363
}
@@ -78,7 +78,7 @@ public struct NoOpTracer: LegacyTracerProtocol {
7878
get {
7979
[:]
8080
}
81-
set {
81+
nonmutating set {
8282
// ignore
8383
}
8484
}

0 commit comments

Comments
 (0)