Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add manual file IO tracking for Swift.Data and Swift.FileManager #4605

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
f1f5a44
fix(tests): add swizzling for NSFileManager
philprime Dec 6, 2024
b196c30
Update CHANGELOG.MD
philprime Dec 6, 2024
c0bb33d
Add iOS 18 and macOS 15 to GH workflow tests
philprime Dec 6, 2024
bc22ac9
Revert removal of import statement
philprime Dec 6, 2024
effcf8e
fix: add OS availability check to file manager swizzling
philprime Dec 6, 2024
7bf668c
add tvOS 18 and mac catalyst to test workflows
philprime Dec 6, 2024
74dd90c
rename SentryNSDataTracker to SentryFileIOTracker; add SentryDataWrapper
philprime Dec 12, 2024
750052a
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Dec 13, 2024
123871d
revert changes after splitting PR
philprime Dec 13, 2024
e002163
revert changes after splitting PR
philprime Dec 13, 2024
ef74f63
removed deprecated method
philprime Dec 16, 2024
dc8c924
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Dec 16, 2024
11c4806
Remove header
philprime Dec 16, 2024
5dc2ead
add WIP for tracking file.read/file.write spans
philprime Dec 17, 2024
be33890
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Dec 18, 2024
07abf5d
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Dec 18, 2024
7047a61
wip
philprime Dec 18, 2024
036da29
add wip changes to reuse data tracker in Swift
philprime Dec 20, 2024
e6cf6f0
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Jan 9, 2025
c856d5a
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Jan 13, 2025
8a3a012
refactor to type extension
philprime Jan 13, 2025
b03c19a
add trace origin to swift file
philprime Jan 13, 2025
1e4c13e
add file io tracker to dependency container
philprime Jan 13, 2025
335207c
refactor changes
philprime Jan 13, 2025
b790458
wip
philprime Jan 13, 2025
4ff6f4e
revert changes in SentrySpanOperations.h
philprime Jan 13, 2025
4ef283e
add more tests, refactored tests
philprime Jan 13, 2025
f29de60
remove unused imported headers
philprime Jan 13, 2025
7f22a1d
Merge branch 'main' into philprime/file-io-tracking-fix
philprime Jan 13, 2025
89e13c0
add more verbose xcframework build logs
philprime Jan 14, 2025
3828edd
refactor measure methods to Swift
philprime Jan 14, 2025
7143715
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Jan 14, 2025
0c917bb
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Jan 14, 2025
f6954d2
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Jan 16, 2025
444a139
applied feedback
philprime Jan 16, 2025
f1e4816
add defer to finish tracking nsdata
philprime Jan 16, 2025
7595a6a
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Jan 22, 2025
530ca0e
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Jan 23, 2025
185097a
fix changelog
philprime Jan 23, 2025
2ffd120
fix duplicate spans
philprime Jan 23, 2025
0ca0bcb
revert change in sample
philprime Jan 23, 2025
15393b0
Update Sources/Swift/Integrations/Performance/IO/Data+SentryTracing.s…
philprime Feb 6, 2025
f12b0c3
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Feb 6, 2025
5d688e6
wip
philprime Feb 12, 2025
c1a15fe
wip
philprime Feb 13, 2025
244d1f0
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Feb 13, 2025
732f394
wip
philprime Feb 13, 2025
2105097
disable swizzling in file io tests
philprime Feb 13, 2025
c08b598
fix test configuration
philprime Feb 13, 2025
8b609d9
add more tests
philprime Feb 13, 2025
b54b4f3
Add more tests
philprime Feb 13, 2025
eb8ed5d
add tests
philprime Feb 13, 2025
e4be2f7
Merge remote-tracking branch 'origin/main' into philprime/file-io-tra…
philprime Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Improvements

- Improve compiler error message for missing Swift declarations due to APPLICATION_EXTENSION_API_ONLY (#4603)
- Add file IO tracking wrapper for Swift.Data (#4605)

### Fixes

Expand Down
4 changes: 4 additions & 0 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@
A8AFFCD42907E0CA00967CD7 /* SentryRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8AFFCD32907E0CA00967CD7 /* SentryRequestTests.swift */; };
A8F17B2E2901765900990B25 /* SentryRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = A8F17B2D2901765900990B25 /* SentryRequest.m */; };
A8F17B342902870300990B25 /* SentryHttpStatusCodeRange.m in Sources */ = {isa = PBXBuildFile; fileRef = A8F17B332902870300990B25 /* SentryHttpStatusCodeRange.m */; };
D4EDF9842D0B2A210071E7B3 /* SentryDataWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EDF9832D0B2A1D0071E7B3 /* SentryDataWrapper.swift */; };
D8019910286B089000C277F0 /* SentryCrashReportSinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D801990F286B089000C277F0 /* SentryCrashReportSinkTests.swift */; };
D802994E2BA836EF000F0081 /* SentryOnDemandReplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = D802994D2BA836EF000F0081 /* SentryOnDemandReplay.swift */; };
D80299502BA83A88000F0081 /* SentryPixelBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D802994F2BA83A88000F0081 /* SentryPixelBuffer.swift */; };
Expand Down Expand Up @@ -1859,6 +1860,7 @@
A8AFFCD32907E0CA00967CD7 /* SentryRequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryRequestTests.swift; sourceTree = "<group>"; };
A8F17B2D2901765900990B25 /* SentryRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryRequest.m; sourceTree = "<group>"; };
A8F17B332902870300990B25 /* SentryHttpStatusCodeRange.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryHttpStatusCodeRange.m; sourceTree = "<group>"; };
D4EDF9832D0B2A1D0071E7B3 /* SentryDataWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDataWrapper.swift; sourceTree = "<group>"; };
D800942628F82F3A005D3943 /* SwiftDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftDescriptor.swift; sourceTree = "<group>"; };
D801990F286B089000C277F0 /* SentryCrashReportSinkTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashReportSinkTests.swift; sourceTree = "<group>"; };
D802994D2BA836EF000F0081 /* SentryOnDemandReplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryOnDemandReplay.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2114,6 +2116,7 @@
621D9F2D2B9B030E003D94DE /* Helper */ = {
isa = PBXGroup;
children = (
D4EDF9832D0B2A1D0071E7B3 /* SentryDataWrapper.swift */,
84B0E0062CD963F9007FB332 /* SentryIconography.swift */,
D8739CF62BECFF86007D2F66 /* Log */,
621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */,
Expand Down Expand Up @@ -4762,6 +4765,7 @@
7BB65501253DC1B500887E87 /* SentryUserFeedback.m in Sources */,
7D5C441A237C2E1F00DAB0A3 /* SentrySDK.m in Sources */,
7D65260E237F649E00113EA2 /* SentryScope.m in Sources */,
D4EDF9842D0B2A210071E7B3 /* SentryDataWrapper.swift in Sources */,
84281C472A57905700EE88F2 /* SentrySample.m in Sources */,
84AC61D329F7541E009EEF61 /* SentryDispatchSourceWrapper.m in Sources */,
62A456E52B0370E0003F19A1 /* SentryUIEventTrackerTransactionMode.m in Sources */,
Expand Down
348 changes: 348 additions & 0 deletions Sources/Swift/Helper/SentryDataWrapper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,348 @@
//
// SentryDataWrapper.swift
// Sentry
//
// Created by Philip Niedertscheider on 12.12.24.
// Copyright © 2024 Sentry. All rights reserved.
//

/// A drop-in replacement for the standard ``Swift.Data`` but with automatic tracking for file I/O operations.
///
/// This structure is intended to resemble the same method signatures as of ``Swift.Data``.
@available(iOS 18, macOS 15, tvOS 18, *)
@frozen public struct SentryDataWrapper: Equatable, Hashable, RandomAccessCollection, MutableCollection, RangeReplaceableCollection, MutableDataProtocol, ContiguousBytes, Sendable {

/// The wrapped data
public private(set) var data: Data

/// Convenience initializer to wrap an existing `Data` instance.
public init(data: Data) {
self.data = data
}

Check warning on line 21 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L20-L21

Added lines #L20 - L21 were not covered by tests

/// See `Data.init(bytes:count:)`
public init(bytes: UnsafeRawPointer, count: Int) {
self.data = Data(bytes: bytes, count: count)
}

Check warning on line 26 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L25-L26

Added lines #L25 - L26 were not covered by tests

/// See `Data.init(buffer:)`
public init<SourceType>(buffer: UnsafeBufferPointer<SourceType>) {
self.data = Data(buffer: buffer)
}

Check warning on line 31 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L30-L31

Added lines #L30 - L31 were not covered by tests

/// See `Data.init(buffer:)`
public init<SourceType>(buffer: UnsafeMutableBufferPointer<SourceType>) {
self.data = Data(buffer: buffer)
}

Check warning on line 36 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L35-L36

Added lines #L35 - L36 were not covered by tests

/// See `Data.init(repeating:count:)`
public init(repeating repeatedValue: UInt8, count: Int) {
self.data = Data(repeating: repeatedValue, count: count)
}

Check warning on line 41 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L40-L41

Added lines #L40 - L41 were not covered by tests

/// See `Data.init(capacity:)`
public init(capacity: Int) {
self.data = Data(capacity: capacity)
}

Check warning on line 46 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L45-L46

Added lines #L45 - L46 were not covered by tests

/// See `Data.init(count:)`
public init(count: Int) {
self.data = Data(count: count)
}

Check warning on line 51 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L50-L51

Added lines #L50 - L51 were not covered by tests

/// See `Data.init()`
public init() {
self.data = Data()
}

Check warning on line 56 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L55-L56

Added lines #L55 - L56 were not covered by tests

/// See `Data.init(bytesNoCopy:count:deallocator:)`
public init(bytesNoCopy bytes: UnsafeMutableRawPointer, count: Int, deallocator: Data.Deallocator) {
self.data = Data(bytesNoCopy: bytes, count: count, deallocator: deallocator)
}

Check warning on line 61 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L60-L61

Added lines #L60 - L61 were not covered by tests

/// See `Data.init(_:)`
public init<S>(_ elements: S) where S: Sequence, S.Element == UInt8 {
self.data = Data(elements)
}

Check warning on line 66 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L65-L66

Added lines #L65 - L66 were not covered by tests

/// See `Data.init(bytes:)`
@available(swift 4.2)
@available(swift, deprecated: 5, message: "use `init(_:)` instead")
public init<S>(bytes elements: S) where S: Sequence, S.Element == UInt8 {
self.data = Data(bytes: elements)
}

Check warning on line 73 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L72-L73

Added lines #L72 - L73 were not covered by tests

/// See `Data.init(contentsOf:options:)`
public init(contentsOf url: URL, options: Data.ReadingOptions = []) throws {
// start file.read via static tracker
self.data = try Data(contentsOf: url, options: options)
// end file.read via static tracker
}

Check warning on line 80 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L77-L80

Added lines #L77 - L80 were not covered by tests

/// See `Data.reserveCapacity(_:)`
public mutating func reserveCapacity(_ minimumCapacity: Int) {
self.data.reserveCapacity(minimumCapacity)
}

Check warning on line 85 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L84-L85

Added lines #L84 - L85 were not covered by tests

/// See `Data.count`
public var count: Int {
return self.data.count
}

Check warning on line 90 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L89-L90

Added lines #L89 - L90 were not covered by tests

/// See `Data.regions`
public var regions: CollectionOfOne<Data> {
return self.data.regions
}

Check warning on line 95 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L94-L95

Added lines #L94 - L95 were not covered by tests

/// See `Data.withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R`
@available(swift, deprecated: 5, message: "use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R` instead")
public func withUnsafeBytes<ResultType, ContentType>(_ body: (UnsafePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
return try self.data.withUnsafeBytes(body)
}

Check warning on line 101 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L100-L101

Added lines #L100 - L101 were not covered by tests

/// See `Data.withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R`
public func withUnsafeBytes<ResultType>(_ body: (UnsafeRawBufferPointer) throws -> ResultType) rethrows -> ResultType {
return try self.data.withUnsafeBytes(body)
}

Check warning on line 106 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L105-L106

Added lines #L105 - L106 were not covered by tests

/// See `Data.withContiguousStorageIfAvailable<ResultType>(_ body: (_ buffer: UnsafeBufferPointer<UInt8>) throws -> ResultType) rethrows -> ResultType?`
public func withContiguousStorageIfAvailable<ResultType>(_ body: (_ buffer: UnsafeBufferPointer<UInt8>) throws -> ResultType) rethrows -> ResultType? {
return try self.data.withContiguousStorageIfAvailable(body)
}

Check warning on line 111 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L110-L111

Added lines #L110 - L111 were not covered by tests

/// See `Data.withUnsafeMutableBytes<R>(_: (UnsafeMutableRawBufferPointer) throws -> R) rethrows -> R`
public mutating func withUnsafeMutableBytes<ResultType>(_ body: (UnsafeMutableRawBufferPointer) throws -> ResultType) rethrows -> ResultType {
return try self.data.withUnsafeMutableBytes(body)
}

Check warning on line 116 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L115-L116

Added lines #L115 - L116 were not covered by tests

/// See `Data.copyBytes(to:count:)`
public func copyBytes(to pointer: UnsafeMutablePointer<UInt8>, count: Int) {
self.data.copyBytes(to: pointer, count: count)
}

Check warning on line 121 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L120-L121

Added lines #L120 - L121 were not covered by tests

/// See `Data.copyBytes(to:from:)`
public func copyBytes(to pointer: UnsafeMutablePointer<UInt8>, from range: Range<Data.Index>) {
self.data.copyBytes(to: pointer, from: range)
}

Check warning on line 126 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L125-L126

Added lines #L125 - L126 were not covered by tests

/// See `Data.copyBytes(to:from:)`
public func copyBytes<DestinationType>(to buffer: UnsafeMutableBufferPointer<DestinationType>, from range: Range<Data.Index>? = nil) -> Int {
return self.data.copyBytes(to: buffer, from: range)
}

Check warning on line 131 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L130-L131

Added lines #L130 - L131 were not covered by tests

/// See `Data.enumerateBytes(_:)`
@available(swift, deprecated: 5, message: "use `regions` or `for-in` instead")
public func enumerateBytes(_ block: (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Data.Index, _ stop: inout Bool) -> Void) {
self.data.enumerateBytes(block)
}

Check warning on line 137 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L136-L137

Added lines #L136 - L137 were not covered by tests

/// See `Data.append(_:)`
public mutating func append(_ bytes: UnsafePointer<UInt8>, count: Int) {
self.data.append(bytes, count: count)
}

Check warning on line 142 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L141-L142

Added lines #L141 - L142 were not covered by tests

/// See `Data.append(_:)`
public mutating func append(_ other: Data) {
self.data.append(other)
}

Check warning on line 147 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L146-L147

Added lines #L146 - L147 were not covered by tests

/// See `Data.append<SourceType>(_ buffer: UnsafeBufferPointer<SourceType>)`
public mutating func append<SourceType>(_ buffer: UnsafeBufferPointer<SourceType>) {
self.data.append(buffer)
}

Check warning on line 152 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L151-L152

Added lines #L151 - L152 were not covered by tests

/// See `Data.append(contentsOf:)`
public mutating func append(contentsOf bytes: [UInt8]) {
self.data.append(contentsOf: bytes)
}

Check warning on line 157 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L156-L157

Added lines #L156 - L157 were not covered by tests

/// See `Data.append(contentsOf:)`
public mutating func append<S>(contentsOf elements: S) where S: Sequence, S.Element == UInt8 {
self.data.append(contentsOf: elements)
}

Check warning on line 162 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L161-L162

Added lines #L161 - L162 were not covered by tests

/// See `Data.resetBytes(in:)`
public mutating func resetBytes(in range: Range<Data.Index>) {
self.data.resetBytes(in: range)
}

Check warning on line 167 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L166-L167

Added lines #L166 - L167 were not covered by tests

/// See `Data.replaceSubrange(_:with:)`
public mutating func replaceSubrange(_ subrange: Range<Data.Index>, with data: Data) {
self.data.replaceSubrange(subrange, with: data)
}

Check warning on line 172 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L171-L172

Added lines #L171 - L172 were not covered by tests

/// See `Data.replaceSubrange(_:with:)`
public mutating func replaceSubrange<SourceType>(_ subrange: Range<Data.Index>, with buffer: UnsafeBufferPointer<SourceType>) {
self.data.replaceSubrange(subrange, with: buffer)
}

Check warning on line 177 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L176-L177

Added lines #L176 - L177 were not covered by tests

/// See `Data.replaceSubrange<ByteCollection>(_ subrange: Range<Data.Index>, with newElements: ByteCollection) where ByteCollection: Collection, ByteCollection.Element == UInt8`
public mutating func replaceSubrange<ByteCollection>(_ subrange: Range<Data.Index>, with newElements: ByteCollection) where ByteCollection: Collection, ByteCollection.Element == UInt8 {
self.data.replaceSubrange(subrange, with: newElements)
}

Check warning on line 182 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L181-L182

Added lines #L181 - L182 were not covered by tests

/// See `Data.replaceSubrange(_:with:)`
public mutating func replaceSubrange(_ subrange: Range<Data.Index>, with bytes: UnsafeRawPointer, count cnt: Int) {
self.data.replaceSubrange(subrange, with: bytes, count: cnt)
}

Check warning on line 187 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L186-L187

Added lines #L186 - L187 were not covered by tests

/// See `Data.subdata(in:)`
public func subdata(in range: Range<Data.Index>) -> Data {
return self.data.subdata(in: range)
}

Check warning on line 192 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L191-L192

Added lines #L191 - L192 were not covered by tests

/// See `Data.write(to:options:)`
public func write(to url: URL, options: Data.WritingOptions = []) throws {
// begin file.write via static tracker
try self.data.write(to: url, options: options)
// end file.write via static tracker
}

Check warning on line 199 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L196-L199

Added lines #L196 - L199 were not covered by tests

/// The hash value for the data.
public func hash(into hasher: inout Hasher) {
self.data.hash(into: &hasher)
}

Check warning on line 204 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L203-L204

Added lines #L203 - L204 were not covered by tests

public func advanced(by amount: Int) -> Data {
return self.data.advanced(by: amount)
}

Check warning on line 208 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L207-L208

Added lines #L207 - L208 were not covered by tests

/// Sets or returns the byte at the specified index.
public subscript(index: Data.Index) -> UInt8 {
get {
return self.data[index]
}

Check warning on line 214 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L213-L214

Added lines #L213 - L214 were not covered by tests
set {
self.data[index] = newValue
}

Check warning on line 217 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L216-L217

Added lines #L216 - L217 were not covered by tests
}

/// See `Data.subscript(bounds:)`
public subscript(bounds: Range<Data.Index>) -> Data {
get {
return self.data[bounds]
}

Check warning on line 224 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L223-L224

Added lines #L223 - L224 were not covered by tests
set {
self.data[bounds] = newValue
}

Check warning on line 227 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L226-L227

Added lines #L226 - L227 were not covered by tests
}

/// See `Data.subscript<R>(rangeExpression: R) -> Data where R: RangeExpression, R.Bound: FixedWidthInteger`
public subscript<R>(rangeExpression: R) -> Data where R: RangeExpression, R.Bound: FixedWidthInteger {
get {
self.data[rangeExpression]
}

Check warning on line 234 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L233-L234

Added lines #L233 - L234 were not covered by tests
set {
self.data[rangeExpression] = newValue
}

Check warning on line 237 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L236-L237

Added lines #L236 - L237 were not covered by tests
}

/// See `Data.startIndex`
public var startIndex: Data.Index {
return self.data.startIndex
}

Check warning on line 243 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L242-L243

Added lines #L242 - L243 were not covered by tests

/// See `Data.endIndex`
public var endIndex: Data.Index {
return self.data.endIndex
}

Check warning on line 248 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L247-L248

Added lines #L247 - L248 were not covered by tests

/// See `Data.index(before:)`
public func index(before i: Data.Index) -> Data.Index {
return self.data.index(before: i)
}

Check warning on line 253 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L252-L253

Added lines #L252 - L253 were not covered by tests

/// See `Data.index(after:)`
public func index(after i: Data.Index) -> Data.Index {
return self.data.index(after: i)
}

Check warning on line 258 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L257-L258

Added lines #L257 - L258 were not covered by tests

/// See `Data.indices`
public var indices: Range<Int> {
return self.data.indices
}

Check warning on line 263 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L262-L263

Added lines #L262 - L263 were not covered by tests

/// See `Data.makeIterator()`
public func makeIterator() -> Data.Iterator {
return self.data.makeIterator()
}

Check warning on line 268 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L267-L268

Added lines #L267 - L268 were not covered by tests

/// See `Data.range(of:options:in:)`
public func range(of dataToFind: Data, options: Data.SearchOptions = [], in range: Range<Data.Index>? = nil) -> Range<Data.Index>? {
return self.data.range(of: dataToFind, options: options, in: range)
}

Check warning on line 273 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L272-L273

Added lines #L272 - L273 were not covered by tests

/// See `Data.==`
public static func == (d1: SentryDataWrapper, d2: SentryDataWrapper) -> Bool {
return d1.data == d2.data
}

Check warning on line 278 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L277-L278

Added lines #L277 - L278 were not covered by tests

/// See `Data.hashValue`
public var hashValue: Int {
return self.data.hashValue
}

Check warning on line 283 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L282-L283

Added lines #L282 - L283 were not covered by tests

/// See `Data.init?(base64Encoded:options:)`
public init?(base64Encoded base64String: String, options: Data.Base64DecodingOptions = []) {
guard let data = Data(base64Encoded: base64String, options: options) else {
return nil

Check warning on line 288 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L288

Added line #L288 was not covered by tests
}
self.data = data
}

Check warning on line 291 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L290-L291

Added lines #L290 - L291 were not covered by tests

/// See `Data.init?(base64Encoded:options:)`
public init?(base64Encoded base64Data: Data, options: Data.Base64DecodingOptions = []) {
guard let data = Data(base64Encoded: base64Data, options: options) else {
return nil

Check warning on line 296 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L296

Added line #L296 was not covered by tests
}
self.data = data
}

Check warning on line 299 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L298-L299

Added lines #L298 - L299 were not covered by tests

/// See `Data.base64EncodedString(options:)`
public func base64EncodedString(options: Data.Base64EncodingOptions = []) -> String {
return self.data.base64EncodedString(options: options)
}

Check warning on line 304 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L303-L304

Added lines #L303 - L304 were not covered by tests

/// See `Data.base64EncodedData(options:)`
public func base64EncodedData(options: Data.Base64EncodingOptions = []) -> Data {
return self.data.base64EncodedData(options: options)
}

Check warning on line 309 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L308-L309

Added lines #L308 - L309 were not covered by tests

/// See `Data.init(referencing:)`
public init(referencing reference: NSData) {
self.data = Data(referencing: reference)
}

Check warning on line 314 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L313-L314

Added lines #L313 - L314 were not covered by tests
}

@available(iOS 18, macOS 15, tvOS 18, *)
extension SentryDataWrapper: CustomStringConvertible, CustomDebugStringConvertible, CustomReflectable {

/// See `Data.description`
public var description: String {
self.data.description
}

Check warning on line 323 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L322-L323

Added lines #L322 - L323 were not covered by tests

/// See `Data.debugDescription`
public var debugDescription: String {
self.data.debugDescription
}

Check warning on line 328 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L327-L328

Added lines #L327 - L328 were not covered by tests

/// See `Data.customMirror`
public var customMirror: Mirror {
self.data.customMirror
}

Check warning on line 333 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L332-L333

Added lines #L332 - L333 were not covered by tests
}

@available(iOS 18, macOS 15, tvOS 18, *)
extension SentryDataWrapper: Codable {

/// See `Data.init(from:)`
public init(from decoder: any Decoder) throws {
self.data = try Data(from: decoder)
}

Check warning on line 342 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L341-L342

Added lines #L341 - L342 were not covered by tests

/// See `Data.encode(to:)`
public func encode(to encoder: any Encoder) throws {
try self.data.encode(to: encoder)
}

Check warning on line 347 in Sources/Swift/Helper/SentryDataWrapper.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Helper/SentryDataWrapper.swift#L346-L347

Added lines #L346 - L347 were not covered by tests
}
Loading
Loading