Skip to content

Commit ebb084e

Browse files
authored
Merge pull request #377 from tayloraswift/upgrade-deps
upgrade swift-bson and a host of other deps
2 parents fb0d07f + c02710e commit ebb084e

File tree

4 files changed

+76
-50
lines changed

4 files changed

+76
-50
lines changed

Package.resolved

Lines changed: 28 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,18 @@ let package:Package = .init(
8585
],
8686
dependencies: [
8787
.package(url: "https://github.com/tayloraswift/swift-bson", .upToNextMinor(
88-
from: "0.3.1")),
88+
from: "0.5.0")),
8989
.package(url: "https://github.com/tayloraswift/swift-dom", .upToNextMinor(
9090
from: "1.1.0")),
9191
.package(url: "https://github.com/tayloraswift/swift-grammar", .upToNextMinor(
9292
from: "0.4.0")),
9393
.package(url: "https://github.com/tayloraswift/swift-hash", .upToNextMinor(
9494
from: "0.7.1")),
9595
.package(url: "https://github.com/tayloraswift/swift-ip", .upToNextMinor(
96-
from: "0.3.0")),
96+
from: "0.3.1")),
9797

9898
.package(url: "https://github.com/tayloraswift/swift-mongodb", .upToNextMinor(
99-
from: "0.28.0")),
99+
from: "0.28.3")),
100100
.package(url: "https://github.com/tayloraswift/swift-unixtime", .upToNextMinor(
101101
from: "0.1.5")),
102102

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import BSON
2+
3+
extension SymbolGraph.Buffer24
4+
{
5+
@frozen @usableFromInline
6+
struct Element
7+
{
8+
@usableFromInline
9+
let int32:Int32
10+
11+
@inlinable
12+
init(int32:Int32)
13+
{
14+
self.int32 = int32
15+
}
16+
}
17+
}
18+
extension SymbolGraph.Buffer24.Element:BSON.BinaryPackable
19+
{
20+
@usableFromInline
21+
typealias Storage = (UInt8, UInt8, UInt8)
22+
23+
@inlinable
24+
static func get(_ storage:Storage) -> Self
25+
{
26+
self.init(int32: .decl
27+
| Int32.init(storage.0)
28+
| Int32.init(storage.1) << 8
29+
| Int32.init(storage.2) << 16)
30+
}
31+
32+
@inlinable
33+
consuming func set() -> Storage
34+
{
35+
(
36+
UInt8.init(truncatingIfNeeded: self.int32),
37+
UInt8.init(truncatingIfNeeded: self.int32 >> 8),
38+
UInt8.init(truncatingIfNeeded: self.int32 >> 16)
39+
)
40+
}
41+
}

Sources/SymbolGraphs/Buffers/SymbolGraph.Buffer24.swift

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension SymbolGraph.Buffer24
3636
}
3737
}
3838

39-
extension SymbolGraph.Buffer24:RandomAccessCollection
39+
extension SymbolGraph.Buffer24:BSONArrayEncodable, RandomAccessCollection
4040
{
4141
@inlinable
4242
var startIndex:Int { self.elements.startIndex }
@@ -45,37 +45,13 @@ extension SymbolGraph.Buffer24:RandomAccessCollection
4545
var endIndex:Int { self.elements.endIndex }
4646

4747
@inlinable
48-
subscript(position:Int) -> CodingElement
49-
{
50-
get
51-
{
52-
let scalar:Int32 = self.elements[position]
53-
return
54-
(
55-
UInt8.init(truncatingIfNeeded: scalar),
56-
UInt8.init(truncatingIfNeeded: scalar >> 8),
57-
UInt8.init(truncatingIfNeeded: scalar >> 16)
58-
)
59-
}
60-
}
61-
}
62-
extension SymbolGraph.Buffer24:BSONArrayEncodable
63-
{
48+
subscript(position:Int) -> Element { .init(int32: self.elements[position]) }
6449
}
6550
extension SymbolGraph.Buffer24:BSONArrayDecodable
6651
{
67-
@usableFromInline
68-
typealias CodingElement = (UInt8, UInt8, UInt8)
69-
7052
@inlinable
71-
init(from bson:borrowing BSON.BinaryBuffer<CodingElement>) throws
53+
init(from bson:borrowing BSON.BinaryArray<Element>) throws
7254
{
73-
self.init(bson.map
74-
{
75-
.decl
76-
| Int32.init($0)
77-
| Int32.init($1) << 8
78-
| Int32.init($2) << 16
79-
})
55+
self.init(bson.map(\.int32))
8056
}
8157
}

0 commit comments

Comments
 (0)