From ea64fb2dd3c98f7333a2864b274503e34caf0cfe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 22:12:55 +0000 Subject: [PATCH 1/3] Bump uniffi from 0.28.1 to 0.28.2 in /common Bumps [uniffi](https://github.com/mozilla/uniffi-rs) from 0.28.1 to 0.28.2. - [Changelog](https://github.com/mozilla/uniffi-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/mozilla/uniffi-rs/compare/v0.28.1...v0.28.2) --- updated-dependencies: - dependency-name: uniffi dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- common/Cargo.lock | 37 ++++++++++++++++++------------------- common/Cargo.toml | 2 +- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/common/Cargo.lock b/common/Cargo.lock index 07a9d7c0..e8c6185f 100644 --- a/common/Cargo.lock +++ b/common/Cargo.lock @@ -1455,9 +1455,9 @@ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "uniffi" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db87def739fe4183947f8419d572d1849a4a09355eba4e988a2105cfd0ac6a7" +checksum = "51ce6280c581045879e11b400bae14686a819df22b97171215d15549efa04ddb" dependencies = [ "anyhow", "camino", @@ -1478,9 +1478,9 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a112599c9556d1581e4a3d72019a74c2c3e122cc27f4af12577a429c4d5e614" +checksum = "5e9f25730c9db2e878521d606f54e921edb719cdd94d735e7f97705d6796d024" dependencies = [ "anyhow", "askama", @@ -1501,9 +1501,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b12684401d2a8508ca9c72a95bbc45906417e42fc80942abaf033bbf01aa33" +checksum = "88dba57ac699bd8ec53d6a352c8dd0e479b33f698c5659831bb1e4ce468c07bd" dependencies = [ "anyhow", "camino", @@ -1512,9 +1512,9 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a22dbe67c1c957ac6e7611bdf605a6218aa86b0eebeb8be58b70ae85ad7d73dc" +checksum = "d2c801f0f05b06df456a2da4c41b9c2c4fdccc6b9916643c6c67275c4c9e4d07" dependencies = [ "quote", "syn", @@ -1522,13 +1522,12 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c35aaad30e3a9e6d4fe34e358d64dbc92ee09045b48591b05fc9f12e0905b" +checksum = "61049e4db6212d0ede80982adf0e1d6fa224e6118387324c5cfbe3083dfb2252" dependencies = [ "anyhow", "bytes", - "camino", "log", "once_cell", "paste", @@ -1537,9 +1536,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db66474c5c61b0f7afc3b4995fecf9b72b340daa5ca0ef3da7778d75eb5482ea" +checksum = "b40fd2249e0c5dcbd2bfa3c263db1ec981f7273dca7f4132bf06a272359a586c" dependencies = [ "bincode", "camino", @@ -1555,9 +1554,9 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d898893f102e0e39b8bcb7e3d2188f4156ba280db32db9e8af1f122d057e9526" +checksum = "c9ad57039b4fafdbf77428d74fff40e0908e5a1731e023c19cfe538f6d4a8ed6" dependencies = [ "anyhow", "bytes", @@ -1567,9 +1566,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6aa4f0cf9d12172d84fc00a35a6c1f3522b526daad05ae739f709f6941b9b6" +checksum = "21fa171d4d258dc51bbd01893cc9608c1b62273d2f9ea55fb64f639e77824567" dependencies = [ "anyhow", "camino", @@ -1580,9 +1579,9 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b044e9c519e0bb51e516ab6f6d8f4f4dcf900ce30d5ad07c03f924e2824f28e" +checksum = "f52299e247419e7e2934bef2f94d7cccb0e6566f3248b1d48b160d8f369a2668" dependencies = [ "anyhow", "textwrap", diff --git a/common/Cargo.toml b/common/Cargo.toml index e9c4db07..e37c1ff4 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -21,7 +21,7 @@ lto = "thin" opt-level = "s" [workspace.dependencies] -uniffi = "0.28.1" +uniffi = "0.28.2" [workspace.lints.rust] unsafe_code = "forbid" From 0d8d954c9d4534fc475494f3eb695a1c7e81c004 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 1 Nov 2024 22:20:53 +0000 Subject: [PATCH 2/3] Apply automatic changes --- apple/Sources/UniFFI/ferrostar.swift | 520 +++++++++++++++++++++++++-- 1 file changed, 485 insertions(+), 35 deletions(-) diff --git a/apple/Sources/UniFFI/ferrostar.swift b/apple/Sources/UniFFI/ferrostar.swift index b6af06a0..2c728268 100644 --- a/apple/Sources/UniFFI/ferrostar.swift +++ b/apple/Sources/UniFFI/ferrostar.swift @@ -167,10 +167,16 @@ private protocol FfiConverter { private protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType {} extension FfiConverterPrimitive { + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public static func lift(_ value: FfiType) throws -> SwiftType { value } + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public static func lower(_ value: SwiftType) -> FfiType { value } @@ -181,6 +187,9 @@ extension FfiConverterPrimitive { private protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} extension FfiConverterRustBuffer { + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public static func lift(_ buf: RustBuffer) throws -> SwiftType { var reader = createReader(data: Data(rustBuffer: buf)) let value = try read(from: &reader) @@ -191,6 +200,9 @@ extension FfiConverterRustBuffer { return value } + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public static func lower(_ value: SwiftType) -> RustBuffer { var writer = createWriter() write(value, into: &writer) @@ -380,6 +392,9 @@ private class UniffiHandleMap { // Public interface members begin here. +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterUInt16: FfiConverterPrimitive { typealias FfiType = UInt16 typealias SwiftType = UInt16 @@ -393,6 +408,9 @@ private struct FfiConverterUInt16: FfiConverterPrimitive { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterUInt32: FfiConverterPrimitive { typealias FfiType = UInt32 typealias SwiftType = UInt32 @@ -406,6 +424,9 @@ private struct FfiConverterUInt32: FfiConverterPrimitive { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterUInt64: FfiConverterPrimitive { typealias FfiType = UInt64 typealias SwiftType = UInt64 @@ -419,6 +440,9 @@ private struct FfiConverterUInt64: FfiConverterPrimitive { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterDouble: FfiConverterPrimitive { typealias FfiType = Double typealias SwiftType = Double @@ -432,6 +456,9 @@ private struct FfiConverterDouble: FfiConverterPrimitive { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterBool: FfiConverter { typealias FfiType = Int8 typealias SwiftType = Bool @@ -453,6 +480,9 @@ private struct FfiConverterBool: FfiConverter { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterString: FfiConverter { typealias SwiftType = String typealias FfiType = RustBuffer @@ -491,6 +521,9 @@ private struct FfiConverterString: FfiConverter { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterData: FfiConverterRustBuffer { typealias SwiftType = Data @@ -506,6 +539,9 @@ private struct FfiConverterData: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterTimestamp: FfiConverterRustBuffer { typealias SwiftType = Date @@ -592,6 +628,9 @@ open class NavigationController: fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public struct NoPointer { public init() {} } @@ -603,17 +642,23 @@ open class NavigationController: self.pointer = pointer } - /// This constructor can be used to instantiate a fake object. - /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - /// may be implemented for classes extending [FFIObject]. - /// - /// - Warning: - /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - /// isn't a backing [Pointer] the FFI lower functions will crash. + // This constructor can be used to instantiate a fake object. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that + // may be implemented for classes extending [FFIObject]. + // + // - Warning: + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there + // isn't a backing [Pointer] the FFI lower functions will crash. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public init(noPointer _: NoPointer) { pointer = nil } + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public func uniffiClonePointer() -> UnsafeMutableRawPointer { try! rustCall { uniffi_ferrostar_fn_clone_navigationcontroller(self.pointer, $0) } } @@ -688,6 +733,9 @@ open class NavigationController: } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeNavigationController: FfiConverter { typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = NavigationController @@ -718,12 +766,18 @@ public struct FfiConverterTypeNavigationController: FfiConverter { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeNavigationController_lift(_ pointer: UnsafeMutableRawPointer) throws -> NavigationController { try FfiConverterTypeNavigationController.lift(pointer) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeNavigationController_lower(_ value: NavigationController) -> UnsafeMutableRawPointer { FfiConverterTypeNavigationController.lower(value) } @@ -784,6 +838,9 @@ open class RouteAdapter: fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public struct NoPointer { public init() {} } @@ -795,17 +852,23 @@ open class RouteAdapter: self.pointer = pointer } - /// This constructor can be used to instantiate a fake object. - /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - /// may be implemented for classes extending [FFIObject]. - /// - /// - Warning: - /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - /// isn't a backing [Pointer] the FFI lower functions will crash. + // This constructor can be used to instantiate a fake object. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that + // may be implemented for classes extending [FFIObject]. + // + // - Warning: + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there + // isn't a backing [Pointer] the FFI lower functions will crash. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public init(noPointer _: NoPointer) { pointer = nil } + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public func uniffiClonePointer() -> UnsafeMutableRawPointer { try! rustCall { uniffi_ferrostar_fn_clone_routeadapter(self.pointer, $0) } } @@ -858,6 +921,9 @@ open class RouteAdapter: } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRouteAdapter: FfiConverter { typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = RouteAdapter @@ -888,10 +954,16 @@ public struct FfiConverterTypeRouteAdapter: FfiConverter { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteAdapter_lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteAdapter { try FfiConverterTypeRouteAdapter.lift(pointer) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteAdapter_lower(_ value: RouteAdapter) -> UnsafeMutableRawPointer { FfiConverterTypeRouteAdapter.lower(value) } @@ -927,6 +999,9 @@ open class RouteDeviationDetectorImpl: fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public struct NoPointer { public init() {} } @@ -938,17 +1013,23 @@ open class RouteDeviationDetectorImpl: self.pointer = pointer } - /// This constructor can be used to instantiate a fake object. - /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - /// may be implemented for classes extending [FFIObject]. - /// - /// - Warning: - /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - /// isn't a backing [Pointer] the FFI lower functions will crash. + // This constructor can be used to instantiate a fake object. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that + // may be implemented for classes extending [FFIObject]. + // + // - Warning: + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there + // isn't a backing [Pointer] the FFI lower functions will crash. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public init(noPointer _: NoPointer) { pointer = nil } + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public func uniffiClonePointer() -> UnsafeMutableRawPointer { try! rustCall { uniffi_ferrostar_fn_clone_routedeviationdetector(self.pointer, $0) } } @@ -1040,6 +1121,9 @@ private func uniffiCallbackInitRouteDeviationDetector() { .vtable) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRouteDeviationDetector: FfiConverter { fileprivate static var handleMap = UniffiHandleMap() @@ -1076,12 +1160,18 @@ public struct FfiConverterTypeRouteDeviationDetector: FfiConverter { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteDeviationDetector_lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteDeviationDetector { try FfiConverterTypeRouteDeviationDetector.lift(pointer) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteDeviationDetector_lower(_ value: RouteDeviationDetector) -> UnsafeMutableRawPointer { FfiConverterTypeRouteDeviationDetector.lower(value) } @@ -1124,6 +1214,9 @@ open class RouteRequestGeneratorImpl: fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public struct NoPointer { public init() {} } @@ -1135,17 +1228,23 @@ open class RouteRequestGeneratorImpl: self.pointer = pointer } - /// This constructor can be used to instantiate a fake object. - /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - /// may be implemented for classes extending [FFIObject]. - /// - /// - Warning: - /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - /// isn't a backing [Pointer] the FFI lower functions will crash. + // This constructor can be used to instantiate a fake object. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that + // may be implemented for classes extending [FFIObject]. + // + // - Warning: + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there + // isn't a backing [Pointer] the FFI lower functions will crash. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public init(noPointer _: NoPointer) { pointer = nil } + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public func uniffiClonePointer() -> UnsafeMutableRawPointer { try! rustCall { uniffi_ferrostar_fn_clone_routerequestgenerator(self.pointer, $0) } } @@ -1223,6 +1322,9 @@ private func uniffiCallbackInitRouteRequestGenerator() { uniffi_ferrostar_fn_init_callback_vtable_routerequestgenerator(&UniffiCallbackInterfaceRouteRequestGenerator.vtable) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRouteRequestGenerator: FfiConverter { fileprivate static var handleMap = UniffiHandleMap() @@ -1259,12 +1361,18 @@ public struct FfiConverterTypeRouteRequestGenerator: FfiConverter { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteRequestGenerator_lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteRequestGenerator { try FfiConverterTypeRouteRequestGenerator.lift(pointer) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteRequestGenerator_lower(_ value: RouteRequestGenerator) -> UnsafeMutableRawPointer { FfiConverterTypeRouteRequestGenerator.lower(value) } @@ -1293,6 +1401,9 @@ open class RouteResponseParserImpl: fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public struct NoPointer { public init() {} } @@ -1304,17 +1415,23 @@ open class RouteResponseParserImpl: self.pointer = pointer } - /// This constructor can be used to instantiate a fake object. - /// - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - /// may be implemented for classes extending [FFIObject]. - /// - /// - Warning: - /// Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - /// isn't a backing [Pointer] the FFI lower functions will crash. + // This constructor can be used to instantiate a fake object. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that + // may be implemented for classes extending [FFIObject]. + // + // - Warning: + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there + // isn't a backing [Pointer] the FFI lower functions will crash. + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public init(noPointer _: NoPointer) { pointer = nil } + #if swift(>=5.8) + @_documentation(visibility: private) + #endif public func uniffiClonePointer() -> UnsafeMutableRawPointer { try! rustCall { uniffi_ferrostar_fn_clone_routeresponseparser(self.pointer, $0) } } @@ -1386,6 +1503,9 @@ private func uniffiCallbackInitRouteResponseParser() { uniffi_ferrostar_fn_init_callback_vtable_routeresponseparser(&UniffiCallbackInterfaceRouteResponseParser.vtable) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRouteResponseParser: FfiConverter { fileprivate static var handleMap = UniffiHandleMap() @@ -1422,10 +1542,16 @@ public struct FfiConverterTypeRouteResponseParser: FfiConverter { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteResponseParser_lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteResponseParser { try FfiConverterTypeRouteResponseParser.lift(pointer) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteResponseParser_lower(_ value: RouteResponseParser) -> UnsafeMutableRawPointer { FfiConverterTypeRouteResponseParser.lower(value) } @@ -1475,6 +1601,9 @@ extension BoundingBox: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeBoundingBox: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BoundingBox { try BoundingBox( @@ -1489,10 +1618,16 @@ public struct FfiConverterTypeBoundingBox: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeBoundingBox_lift(_ buf: RustBuffer) throws -> BoundingBox { try FfiConverterTypeBoundingBox.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeBoundingBox_lower(_ value: BoundingBox) -> RustBuffer { FfiConverterTypeBoundingBox.lower(value) } @@ -1544,6 +1679,9 @@ extension CourseOverGround: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeCourseOverGround: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CourseOverGround { try CourseOverGround( @@ -1558,10 +1696,16 @@ public struct FfiConverterTypeCourseOverGround: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeCourseOverGround_lift(_ buf: RustBuffer) throws -> CourseOverGround { try FfiConverterTypeCourseOverGround.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeCourseOverGround_lower(_ value: CourseOverGround) -> RustBuffer { FfiConverterTypeCourseOverGround.lower(value) } @@ -1611,6 +1755,9 @@ extension GeographicCoordinate: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeGeographicCoordinate: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GeographicCoordinate { try GeographicCoordinate( @@ -1625,10 +1772,16 @@ public struct FfiConverterTypeGeographicCoordinate: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeGeographicCoordinate_lift(_ buf: RustBuffer) throws -> GeographicCoordinate { try FfiConverterTypeGeographicCoordinate.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeGeographicCoordinate_lower(_ value: GeographicCoordinate) -> RustBuffer { FfiConverterTypeGeographicCoordinate.lower(value) } @@ -1690,6 +1843,9 @@ extension Heading: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeHeading: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Heading { try Heading( @@ -1706,10 +1862,16 @@ public struct FfiConverterTypeHeading: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeHeading_lift(_ buf: RustBuffer) throws -> Heading { try FfiConverterTypeHeading.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeHeading_lower(_ value: Heading) -> RustBuffer { FfiConverterTypeHeading.lower(value) } @@ -1752,6 +1914,9 @@ extension LaneInfo: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeLaneInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LaneInfo { try LaneInfo( @@ -1768,10 +1933,16 @@ public struct FfiConverterTypeLaneInfo: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeLaneInfo_lift(_ buf: RustBuffer) throws -> LaneInfo { try FfiConverterTypeLaneInfo.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeLaneInfo_lower(_ value: LaneInfo) -> RustBuffer { FfiConverterTypeLaneInfo.lower(value) } @@ -1814,6 +1985,9 @@ extension LocationSimulationState: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeLocationSimulationState: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LocationSimulationState { try LocationSimulationState( @@ -1830,10 +2004,16 @@ public struct FfiConverterTypeLocationSimulationState: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeLocationSimulationState_lift(_ buf: RustBuffer) throws -> LocationSimulationState { try FfiConverterTypeLocationSimulationState.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeLocationSimulationState_lower(_ value: LocationSimulationState) -> RustBuffer { FfiConverterTypeLocationSimulationState.lower(value) } @@ -1877,6 +2057,9 @@ public struct NavigationControllerConfig { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeNavigationControllerConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NavigationControllerConfig { try NavigationControllerConfig( @@ -1893,10 +2076,16 @@ public struct FfiConverterTypeNavigationControllerConfig: FfiConverterRustBuffer } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeNavigationControllerConfig_lift(_ buf: RustBuffer) throws -> NavigationControllerConfig { try FfiConverterTypeNavigationControllerConfig.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeNavigationControllerConfig_lower(_ value: NavigationControllerConfig) -> RustBuffer { FfiConverterTypeNavigationControllerConfig.lower(value) } @@ -1971,6 +2160,9 @@ extension Route: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRoute: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Route { try Route( @@ -1991,10 +2183,16 @@ public struct FfiConverterTypeRoute: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRoute_lift(_ buf: RustBuffer) throws -> Route { try FfiConverterTypeRoute.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRoute_lower(_ value: Route) -> RustBuffer { FfiConverterTypeRoute.lower(value) } @@ -2125,6 +2323,9 @@ extension RouteStep: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRouteStep: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteStep { try RouteStep( @@ -2151,10 +2352,16 @@ public struct FfiConverterTypeRouteStep: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteStep_lift(_ buf: RustBuffer) throws -> RouteStep { try FfiConverterTypeRouteStep.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteStep_lower(_ value: RouteStep) -> RustBuffer { FfiConverterTypeRouteStep.lower(value) } @@ -2204,6 +2411,9 @@ extension Speed: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeSpeed: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Speed { try Speed( @@ -2218,10 +2428,16 @@ public struct FfiConverterTypeSpeed: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeSpeed_lift(_ buf: RustBuffer) throws -> Speed { try FfiConverterTypeSpeed.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeSpeed_lower(_ value: Speed) -> RustBuffer { FfiConverterTypeSpeed.lower(value) } @@ -2311,6 +2527,9 @@ extension SpokenInstruction: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeSpokenInstruction: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SpokenInstruction { try SpokenInstruction( @@ -2329,10 +2548,16 @@ public struct FfiConverterTypeSpokenInstruction: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeSpokenInstruction_lift(_ buf: RustBuffer) throws -> SpokenInstruction { try FfiConverterTypeSpokenInstruction.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeSpokenInstruction_lower(_ value: SpokenInstruction) -> RustBuffer { FfiConverterTypeSpokenInstruction.lower(value) } @@ -2398,6 +2623,9 @@ extension TripProgress: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeTripProgress: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TripProgress { try TripProgress( @@ -2414,10 +2642,16 @@ public struct FfiConverterTypeTripProgress: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeTripProgress_lift(_ buf: RustBuffer) throws -> TripProgress { try FfiConverterTypeTripProgress.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeTripProgress_lower(_ value: TripProgress) -> RustBuffer { FfiConverterTypeTripProgress.lower(value) } @@ -2485,6 +2719,9 @@ extension UserLocation: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeUserLocation: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UserLocation { try UserLocation( @@ -2505,10 +2742,16 @@ public struct FfiConverterTypeUserLocation: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeUserLocation_lift(_ buf: RustBuffer) throws -> UserLocation { try FfiConverterTypeUserLocation.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeUserLocation_lower(_ value: UserLocation) -> RustBuffer { FfiConverterTypeUserLocation.lower(value) } @@ -2586,6 +2829,9 @@ extension VisualInstruction: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeVisualInstruction: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VisualInstruction { try VisualInstruction( @@ -2604,10 +2850,16 @@ public struct FfiConverterTypeVisualInstruction: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeVisualInstruction_lift(_ buf: RustBuffer) throws -> VisualInstruction { try FfiConverterTypeVisualInstruction.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeVisualInstruction_lower(_ value: VisualInstruction) -> RustBuffer { FfiConverterTypeVisualInstruction.lower(value) } @@ -2701,6 +2953,9 @@ extension VisualInstructionContent: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeVisualInstructionContent: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VisualInstructionContent { try VisualInstructionContent( @@ -2721,10 +2976,16 @@ public struct FfiConverterTypeVisualInstructionContent: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeVisualInstructionContent_lift(_ buf: RustBuffer) throws -> VisualInstructionContent { try FfiConverterTypeVisualInstructionContent.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeVisualInstructionContent_lower(_ value: VisualInstructionContent) -> RustBuffer { FfiConverterTypeVisualInstructionContent.lower(value) } @@ -2771,6 +3032,9 @@ extension Waypoint: Equatable, Hashable { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeWaypoint: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Waypoint { try Waypoint( @@ -2785,10 +3049,16 @@ public struct FfiConverterTypeWaypoint: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeWaypoint_lift(_ buf: RustBuffer) throws -> Waypoint { try FfiConverterTypeWaypoint.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeWaypoint_lower(_ value: Waypoint) -> RustBuffer { FfiConverterTypeWaypoint.lower(value) } @@ -2811,6 +3081,9 @@ public enum CourseFiltering { case raw } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeCourseFiltering: FfiConverterRustBuffer { typealias SwiftType = CourseFiltering @@ -2836,10 +3109,16 @@ public struct FfiConverterTypeCourseFiltering: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeCourseFiltering_lift(_ buf: RustBuffer) throws -> CourseFiltering { try FfiConverterTypeCourseFiltering.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeCourseFiltering_lower(_ value: CourseFiltering) -> RustBuffer { FfiConverterTypeCourseFiltering.lower(value) } @@ -2850,6 +3129,9 @@ public enum InstantiationError { case OptionsJsonParseError } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeInstantiationError: FfiConverterRustBuffer { typealias SwiftType = InstantiationError @@ -2914,6 +3196,9 @@ public enum LocationBias { case none } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeLocationBias: FfiConverterRustBuffer { typealias SwiftType = LocationBias @@ -2952,10 +3237,16 @@ public struct FfiConverterTypeLocationBias: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeLocationBias_lift(_ buf: RustBuffer) throws -> LocationBias { try FfiConverterTypeLocationBias.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeLocationBias_lower(_ value: LocationBias) -> RustBuffer { FfiConverterTypeLocationBias.lower(value) } @@ -2979,6 +3270,9 @@ public enum ManeuverModifier { case sharpLeft } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeManeuverModifier: FfiConverterRustBuffer { typealias SwiftType = ManeuverModifier @@ -3034,10 +3328,16 @@ public struct FfiConverterTypeManeuverModifier: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeManeuverModifier_lift(_ buf: RustBuffer) throws -> ManeuverModifier { try FfiConverterTypeManeuverModifier.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeManeuverModifier_lower(_ value: ManeuverModifier) -> RustBuffer { FfiConverterTypeManeuverModifier.lower(value) } @@ -3071,6 +3371,9 @@ public enum ManeuverType { case exitRotary } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeManeuverType: FfiConverterRustBuffer { typealias SwiftType = ManeuverType @@ -3166,10 +3469,16 @@ public struct FfiConverterTypeManeuverType: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeManeuverType_lift(_ buf: RustBuffer) throws -> ManeuverType { try FfiConverterTypeManeuverType.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeManeuverType_lower(_ value: ManeuverType) -> RustBuffer { FfiConverterTypeManeuverType.lower(value) } @@ -3180,6 +3489,9 @@ public enum ModelError { case PolylineGenerationError(error: String) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeModelError: FfiConverterRustBuffer { typealias SwiftType = ModelError @@ -3219,6 +3531,9 @@ public enum ParsingError { case UnknownParsingError } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeParsingError: FfiConverterRustBuffer { typealias SwiftType = ParsingError @@ -3298,6 +3613,9 @@ public enum RouteDeviation { ) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRouteDeviation: FfiConverterRustBuffer { typealias SwiftType = RouteDeviation @@ -3324,10 +3642,16 @@ public struct FfiConverterTypeRouteDeviation: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteDeviation_lift(_ buf: RustBuffer) throws -> RouteDeviation { try FfiConverterTypeRouteDeviation.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteDeviation_lower(_ value: RouteDeviation) -> RustBuffer { FfiConverterTypeRouteDeviation.lower(value) } @@ -3367,6 +3691,9 @@ public enum RouteDeviationTracking { case custom(detector: RouteDeviationDetector) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRouteDeviationTracking: FfiConverterRustBuffer { typealias SwiftType = RouteDeviationTracking @@ -3403,10 +3730,16 @@ public struct FfiConverterTypeRouteDeviationTracking: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteDeviationTracking_lift(_ buf: RustBuffer) throws -> RouteDeviationTracking { try FfiConverterTypeRouteDeviationTracking.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteDeviationTracking_lower(_ value: RouteDeviationTracking) -> RustBuffer { FfiConverterTypeRouteDeviationTracking.lower(value) } @@ -3422,6 +3755,9 @@ public enum RouteRequest { case httpGet(url: String, headers: [String: String]) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRouteRequest: FfiConverterRustBuffer { typealias SwiftType = RouteRequest @@ -3459,10 +3795,16 @@ public struct FfiConverterTypeRouteRequest: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteRequest_lift(_ buf: RustBuffer) throws -> RouteRequest { try FfiConverterTypeRouteRequest.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeRouteRequest_lower(_ value: RouteRequest) -> RustBuffer { FfiConverterTypeRouteRequest.lower(value) } @@ -3475,6 +3817,9 @@ public enum RoutingRequestGenerationError { case UnknownRequestGenerationError } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeRoutingRequestGenerationError: FfiConverterRustBuffer { typealias SwiftType = RoutingRequestGenerationError @@ -3521,6 +3866,9 @@ public enum SimulationError { case NotEnoughPoints } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeSimulationError: FfiConverterRustBuffer { typealias SwiftType = SimulationError @@ -3600,6 +3948,9 @@ public enum StepAdvanceMode { ) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeStepAdvanceMode: FfiConverterRustBuffer { typealias SwiftType = StepAdvanceMode @@ -3640,10 +3991,16 @@ public struct FfiConverterTypeStepAdvanceMode: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeStepAdvanceMode_lift(_ buf: RustBuffer) throws -> StepAdvanceMode { try FfiConverterTypeStepAdvanceMode.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeStepAdvanceMode_lower(_ value: StepAdvanceMode) -> RustBuffer { FfiConverterTypeStepAdvanceMode.lower(value) } @@ -3719,6 +4076,9 @@ public enum TripState { case complete } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeTripState: FfiConverterRustBuffer { typealias SwiftType = TripState @@ -3778,10 +4138,16 @@ public struct FfiConverterTypeTripState: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeTripState_lift(_ buf: RustBuffer) throws -> TripState { try FfiConverterTypeTripState.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeTripState_lower(_ value: TripState) -> RustBuffer { FfiConverterTypeTripState.lower(value) } @@ -3807,6 +4173,9 @@ public enum WaypointKind { case via } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeWaypointKind: FfiConverterRustBuffer { typealias SwiftType = WaypointKind @@ -3832,16 +4201,25 @@ public struct FfiConverterTypeWaypointKind: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeWaypointKind_lift(_ buf: RustBuffer) throws -> WaypointKind { try FfiConverterTypeWaypointKind.lift(buf) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeWaypointKind_lower(_ value: WaypointKind) -> RustBuffer { FfiConverterTypeWaypointKind.lower(value) } extension WaypointKind: Equatable, Hashable {} +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionUInt16: FfiConverterRustBuffer { typealias SwiftType = UInt16? @@ -3863,6 +4241,9 @@ private struct FfiConverterOptionUInt16: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionUInt64: FfiConverterRustBuffer { typealias SwiftType = UInt64? @@ -3884,6 +4265,9 @@ private struct FfiConverterOptionUInt64: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionDouble: FfiConverterRustBuffer { typealias SwiftType = Double? @@ -3905,6 +4289,9 @@ private struct FfiConverterOptionDouble: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionString: FfiConverterRustBuffer { typealias SwiftType = String? @@ -3926,6 +4313,9 @@ private struct FfiConverterOptionString: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionTypeCourseOverGround: FfiConverterRustBuffer { typealias SwiftType = CourseOverGround? @@ -3947,6 +4337,9 @@ private struct FfiConverterOptionTypeCourseOverGround: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionTypeSpeed: FfiConverterRustBuffer { typealias SwiftType = Speed? @@ -3968,6 +4361,9 @@ private struct FfiConverterOptionTypeSpeed: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionTypeSpokenInstruction: FfiConverterRustBuffer { typealias SwiftType = SpokenInstruction? @@ -3989,6 +4385,9 @@ private struct FfiConverterOptionTypeSpokenInstruction: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionTypeVisualInstruction: FfiConverterRustBuffer { typealias SwiftType = VisualInstruction? @@ -4010,6 +4409,9 @@ private struct FfiConverterOptionTypeVisualInstruction: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionTypeVisualInstructionContent: FfiConverterRustBuffer { typealias SwiftType = VisualInstructionContent? @@ -4031,6 +4433,9 @@ private struct FfiConverterOptionTypeVisualInstructionContent: FfiConverterRustB } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionTypeManeuverModifier: FfiConverterRustBuffer { typealias SwiftType = ManeuverModifier? @@ -4052,6 +4457,9 @@ private struct FfiConverterOptionTypeManeuverModifier: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionTypeManeuverType: FfiConverterRustBuffer { typealias SwiftType = ManeuverType? @@ -4073,6 +4481,9 @@ private struct FfiConverterOptionTypeManeuverType: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionSequenceString: FfiConverterRustBuffer { typealias SwiftType = [String]? @@ -4094,6 +4505,9 @@ private struct FfiConverterOptionSequenceString: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterOptionSequenceTypeLaneInfo: FfiConverterRustBuffer { typealias SwiftType = [LaneInfo]? @@ -4115,6 +4529,9 @@ private struct FfiConverterOptionSequenceTypeLaneInfo: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterSequenceString: FfiConverterRustBuffer { typealias SwiftType = [String] @@ -4137,6 +4554,9 @@ private struct FfiConverterSequenceString: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterSequenceTypeGeographicCoordinate: FfiConverterRustBuffer { typealias SwiftType = [GeographicCoordinate] @@ -4159,6 +4579,9 @@ private struct FfiConverterSequenceTypeGeographicCoordinate: FfiConverterRustBuf } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterSequenceTypeLaneInfo: FfiConverterRustBuffer { typealias SwiftType = [LaneInfo] @@ -4181,6 +4604,9 @@ private struct FfiConverterSequenceTypeLaneInfo: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterSequenceTypeRoute: FfiConverterRustBuffer { typealias SwiftType = [Route] @@ -4203,6 +4629,9 @@ private struct FfiConverterSequenceTypeRoute: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterSequenceTypeRouteStep: FfiConverterRustBuffer { typealias SwiftType = [RouteStep] @@ -4225,6 +4654,9 @@ private struct FfiConverterSequenceTypeRouteStep: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterSequenceTypeSpokenInstruction: FfiConverterRustBuffer { typealias SwiftType = [SpokenInstruction] @@ -4247,6 +4679,9 @@ private struct FfiConverterSequenceTypeSpokenInstruction: FfiConverterRustBuffer } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterSequenceTypeVisualInstruction: FfiConverterRustBuffer { typealias SwiftType = [VisualInstruction] @@ -4269,6 +4704,9 @@ private struct FfiConverterSequenceTypeVisualInstruction: FfiConverterRustBuffer } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterSequenceTypeWaypoint: FfiConverterRustBuffer { typealias SwiftType = [Waypoint] @@ -4291,6 +4729,9 @@ private struct FfiConverterSequenceTypeWaypoint: FfiConverterRustBuffer { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif private struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { public static func write(_ value: [String: String], into buf: inout [UInt8]) { let len = Int32(value.count) @@ -4320,6 +4761,9 @@ private struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { */ public typealias Uuid = UUID +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct FfiConverterTypeUuid: FfiConverter { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Uuid { let builtinValue = try FfiConverterString.read(from: &buf) @@ -4342,10 +4786,16 @@ public struct FfiConverterTypeUuid: FfiConverter { } } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeUuid_lift(_ value: RustBuffer) throws -> Uuid { try FfiConverterTypeUuid.lift(value) } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public func FfiConverterTypeUuid_lower(_ value: Uuid) -> RustBuffer { FfiConverterTypeUuid.lower(value) } From b3441f6dabd99b98cfb83da91c751b01413fe8f3 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Mon, 4 Nov 2024 12:26:11 +0900 Subject: [PATCH 3/3] Upgrade to the new swift bindgen utility --- .swiftformat | 1 + apple/Sources/UniFFI/ferrostar.swift | 2643 +++++++++++++---------- common/Cargo.lock | 7 + common/Cargo.toml | 1 + common/build-ios.sh | 5 +- common/uniffi-bindgen-swift/Cargo.toml | 18 + common/uniffi-bindgen-swift/src/main.rs | 3 + 7 files changed, 1516 insertions(+), 1162 deletions(-) create mode 100644 common/uniffi-bindgen-swift/Cargo.toml create mode 100644 common/uniffi-bindgen-swift/src/main.rs diff --git a/.swiftformat b/.swiftformat index 09fd015e..945ffffe 100644 --- a/.swiftformat +++ b/.swiftformat @@ -2,6 +2,7 @@ --exclude apple/.build --exclude apple/DemoApp/.build +--exclude apple/Sources/UniFFI/ferrostar.swift # format options diff --git a/apple/Sources/UniFFI/ferrostar.swift b/apple/Sources/UniFFI/ferrostar.swift index 2c728268..cd157817 100644 --- a/apple/Sources/UniFFI/ferrostar.swift +++ b/apple/Sources/UniFFI/ferrostar.swift @@ -1,3 +1,6 @@ +// This file was autogenerated by some hot garbage in the `uniffi` crate. +// Trust me, you don't want to mess with it! + // swiftlint:disable all import Foundation @@ -5,10 +8,10 @@ import Foundation // might be in a separate module, or it might be compiled inline into // this module. This is a bit of light hackery to work with both. #if canImport(ferrostarFFI) - import ferrostarFFI +import ferrostarFFI #endif -private extension RustBuffer { +fileprivate extension RustBuffer { // Allocate a new buffer, copying the contents of a `UInt8` array. init(bytes: [UInt8]) { let rbuf = bytes.withUnsafeBufferPointer { ptr in @@ -18,7 +21,7 @@ private extension RustBuffer { } static func empty() -> RustBuffer { - RustBuffer(capacity: 0, len: 0, data: nil) + RustBuffer(capacity: 0, len:0, data: nil) } static func from(_ ptr: UnsafeBufferPointer) -> RustBuffer { @@ -32,7 +35,7 @@ private extension RustBuffer { } } -private extension ForeignBytes { +fileprivate extension ForeignBytes { init(bufferPointer: UnsafeBufferPointer) { self.init(len: Int32(bufferPointer.count), data: bufferPointer.baseAddress) } @@ -45,7 +48,7 @@ private extension ForeignBytes { // Helper classes/extensions that don't change. // Someday, this will be in a library of its own. -private extension Data { +fileprivate extension Data { init(rustBuffer: RustBuffer) { self.init( bytesNoCopy: rustBuffer.data!, @@ -69,15 +72,15 @@ private extension Data { // // Instead, the read() method and these helper functions input a tuple of data -private func createReader(data: Data) -> (data: Data, offset: Data.Index) { +fileprivate func createReader(data: Data) -> (data: Data, offset: Data.Index) { (data: data, offset: 0) } // Reads an integer at the current offset, in big-endian order, and advances // the offset on success. Throws if reading the integer would move the // offset past the end of the buffer. -private func readInt(_ reader: inout (data: Data, offset: Data.Index)) throws -> T { - let range = reader.offset ..< reader.offset + MemoryLayout.size +fileprivate func readInt(_ reader: inout (data: Data, offset: Data.Index)) throws -> T { + let range = reader.offset...size guard reader.data.count >= range.upperBound else { throw UniffiInternalError.bufferOverflow } @@ -87,50 +90,50 @@ private func readInt(_ reader: inout (data: Data, offset: return value as! T } var value: T = 0 - let _ = withUnsafeMutableBytes(of: &value) { reader.data.copyBytes(to: $0, from: range) } + let _ = withUnsafeMutableBytes(of: &value, { reader.data.copyBytes(to: $0, from: range)}) reader.offset = range.upperBound return value.bigEndian } // Reads an arbitrary number of bytes, to be used to read // raw bytes, this is useful when lifting strings -private func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> [UInt8] { - let range = reader.offset ..< (reader.offset + count) +fileprivate func readBytes(_ reader: inout (data: Data, offset: Data.Index), count: Int) throws -> Array { + let range = reader.offset..<(reader.offset+count) guard reader.data.count >= range.upperBound else { throw UniffiInternalError.bufferOverflow } var value = [UInt8](repeating: 0, count: count) - value.withUnsafeMutableBufferPointer { buffer in + value.withUnsafeMutableBufferPointer({ buffer in reader.data.copyBytes(to: buffer, from: range) - } + }) reader.offset = range.upperBound return value } // Reads a float at the current offset. -private func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { - try Float(bitPattern: readInt(&reader)) +fileprivate func readFloat(_ reader: inout (data: Data, offset: Data.Index)) throws -> Float { + return Float(bitPattern: try readInt(&reader)) } // Reads a float at the current offset. -private func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { - try Double(bitPattern: readInt(&reader)) +fileprivate func readDouble(_ reader: inout (data: Data, offset: Data.Index)) throws -> Double { + return Double(bitPattern: try readInt(&reader)) } // Indicates if the offset has reached the end of the buffer. -private func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { - reader.offset < reader.data.count +fileprivate func hasRemaining(_ reader: (data: Data, offset: Data.Index)) -> Bool { + return reader.offset < reader.data.count } // Define writer functionality. Normally this would be defined in a class or // struct, but we use standalone functions instead in order to make external // types work. See the above discussion on Readers for details. -private func createWriter() -> [UInt8] { - [] +fileprivate func createWriter() -> [UInt8] { + return [] } -private func writeBytes(_ writer: inout [UInt8], _ byteArr: some Sequence) { +fileprivate func writeBytes(_ writer: inout [UInt8], _ byteArr: S) where S: Sequence, S.Element == UInt8 { writer.append(contentsOf: byteArr) } @@ -138,22 +141,22 @@ private func writeBytes(_ writer: inout [UInt8], _ byteArr: some Sequence // // Warning: make sure what you are trying to write // is in the correct type! -private func writeInt(_ writer: inout [UInt8], _ value: some FixedWidthInteger) { +fileprivate func writeInt(_ writer: inout [UInt8], _ value: T) { var value = value.bigEndian withUnsafeBytes(of: &value) { writer.append(contentsOf: $0) } } -private func writeFloat(_ writer: inout [UInt8], _ value: Float) { +fileprivate func writeFloat(_ writer: inout [UInt8], _ value: Float) { writeInt(&writer, value.bitPattern) } -private func writeDouble(_ writer: inout [UInt8], _ value: Double) { +fileprivate func writeDouble(_ writer: inout [UInt8], _ value: Double) { writeInt(&writer, value.bitPattern) } // Protocol for types that transfer other types across the FFI. This is // analogous to the Rust trait of the same name. -private protocol FfiConverter { +fileprivate protocol FfiConverter { associatedtype FfiType associatedtype SwiftType @@ -164,32 +167,32 @@ private protocol FfiConverter { } // Types conforming to `Primitive` pass themselves directly over the FFI. -private protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType {} +fileprivate protocol FfiConverterPrimitive: FfiConverter where FfiType == SwiftType { } extension FfiConverterPrimitive { - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public static func lift(_ value: FfiType) throws -> SwiftType { - value + return value } - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public static func lower(_ value: SwiftType) -> FfiType { - value + return value } } // Types conforming to `FfiConverterRustBuffer` lift and lower into a `RustBuffer`. // Used for complex types where it's hard to write a custom lift/lower. -private protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} +fileprivate protocol FfiConverterRustBuffer: FfiConverter where FfiType == RustBuffer {} extension FfiConverterRustBuffer { - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public static func lift(_ buf: RustBuffer) throws -> SwiftType { var reader = createReader(data: Data(rustBuffer: buf)) let value = try read(from: &reader) @@ -200,19 +203,18 @@ extension FfiConverterRustBuffer { return value } - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public static func lower(_ value: SwiftType) -> RustBuffer { - var writer = createWriter() - write(value, into: &writer) - return RustBuffer(bytes: writer) + var writer = createWriter() + write(value, into: &writer) + return RustBuffer(bytes: writer) } } - // An error type for FFI errors. These errors occur at the UniFFI level, not // the library level. -private enum UniffiInternalError: LocalizedError { +fileprivate enum UniffiInternalError: LocalizedError { case bufferOverflow case incompleteData case unexpectedOptionalTag @@ -225,37 +227,37 @@ private enum UniffiInternalError: LocalizedError { public var errorDescription: String? { switch self { - case .bufferOverflow: "Reading the requested value would read past the end of the buffer" - case .incompleteData: "The buffer still has data after lifting its containing value" - case .unexpectedOptionalTag: "Unexpected optional tag; should be 0 or 1" - case .unexpectedEnumCase: "Raw enum value doesn't match any cases" - case .unexpectedNullPointer: "Raw pointer value was null" - case .unexpectedRustCallStatusCode: "Unexpected RustCallStatus code" - case .unexpectedRustCallError: "CALL_ERROR but no errorClass specified" - case .unexpectedStaleHandle: "The object in the handle map has been dropped already" - case let .rustPanic(message): message + case .bufferOverflow: return "Reading the requested value would read past the end of the buffer" + case .incompleteData: return "The buffer still has data after lifting its containing value" + case .unexpectedOptionalTag: return "Unexpected optional tag; should be 0 or 1" + case .unexpectedEnumCase: return "Raw enum value doesn't match any cases" + case .unexpectedNullPointer: return "Raw pointer value was null" + case .unexpectedRustCallStatusCode: return "Unexpected RustCallStatus code" + case .unexpectedRustCallError: return "CALL_ERROR but no errorClass specified" + case .unexpectedStaleHandle: return "The object in the handle map has been dropped already" + case let .rustPanic(message): return message } } } -private extension NSLock { +fileprivate extension NSLock { func withLock(f: () throws -> T) rethrows -> T { - lock() + self.lock() defer { self.unlock() } return try f() } } -private let CALL_SUCCESS: Int8 = 0 -private let CALL_ERROR: Int8 = 1 -private let CALL_UNEXPECTED_ERROR: Int8 = 2 -private let CALL_CANCELLED: Int8 = 3 +fileprivate let CALL_SUCCESS: Int8 = 0 +fileprivate let CALL_ERROR: Int8 = 1 +fileprivate let CALL_UNEXPECTED_ERROR: Int8 = 2 +fileprivate let CALL_CANCELLED: Int8 = 3 -private extension RustCallStatus { +fileprivate extension RustCallStatus { init() { self.init( code: CALL_SUCCESS, - errorBuf: RustBuffer( + errorBuf: RustBuffer.init( capacity: 0, len: 0, data: nil @@ -269,67 +271,66 @@ private func rustCall(_ callback: (UnsafeMutablePointer) -> T return try makeRustCall(callback, errorHandler: neverThrow) } -private func rustCallWithError( - _ errorHandler: @escaping (RustBuffer) throws -> some Swift.Error, - _ callback: (UnsafeMutablePointer) -> T -) throws -> T { +private func rustCallWithError( + _ errorHandler: @escaping (RustBuffer) throws -> E, + _ callback: (UnsafeMutablePointer) -> T) throws -> T { try makeRustCall(callback, errorHandler: errorHandler) } -private func makeRustCall( +private func makeRustCall( _ callback: (UnsafeMutablePointer) -> T, - errorHandler: ((RustBuffer) throws -> some Swift.Error)? + errorHandler: ((RustBuffer) throws -> E)? ) throws -> T { uniffiEnsureInitialized() - var callStatus = RustCallStatus() + var callStatus = RustCallStatus.init() let returnedVal = callback(&callStatus) try uniffiCheckCallStatus(callStatus: callStatus, errorHandler: errorHandler) return returnedVal } -private func uniffiCheckCallStatus( +private func uniffiCheckCallStatus( callStatus: RustCallStatus, - errorHandler: ((RustBuffer) throws -> some Swift.Error)? + errorHandler: ((RustBuffer) throws -> E)? ) throws { switch callStatus.code { - case CALL_SUCCESS: - return + case CALL_SUCCESS: + return - case CALL_ERROR: - if let errorHandler { - throw try errorHandler(callStatus.errorBuf) - } else { - callStatus.errorBuf.deallocate() - throw UniffiInternalError.unexpectedRustCallError - } + case CALL_ERROR: + if let errorHandler = errorHandler { + throw try errorHandler(callStatus.errorBuf) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.unexpectedRustCallError + } - case CALL_UNEXPECTED_ERROR: - // When the rust code sees a panic, it tries to construct a RustBuffer - // with the message. But if that code panics, then it just sends back - // an empty buffer. - if callStatus.errorBuf.len > 0 { - throw try UniffiInternalError.rustPanic(FfiConverterString.lift(callStatus.errorBuf)) - } else { - callStatus.errorBuf.deallocate() - throw UniffiInternalError.rustPanic("Rust panic") - } + case CALL_UNEXPECTED_ERROR: + // When the rust code sees a panic, it tries to construct a RustBuffer + // with the message. But if that code panics, then it just sends back + // an empty buffer. + if callStatus.errorBuf.len > 0 { + throw UniffiInternalError.rustPanic(try FfiConverterString.lift(callStatus.errorBuf)) + } else { + callStatus.errorBuf.deallocate() + throw UniffiInternalError.rustPanic("Rust panic") + } - case CALL_CANCELLED: - fatalError("Cancellation not supported yet") + case CALL_CANCELLED: + fatalError("Cancellation not supported yet") - default: - throw UniffiInternalError.unexpectedRustCallStatusCode + default: + throw UniffiInternalError.unexpectedRustCallStatusCode } } private func uniffiTraitInterfaceCall( callStatus: UnsafeMutablePointer, makeCall: () throws -> T, - writeReturn: (T) -> Void + writeReturn: (T) -> () ) { do { try writeReturn(makeCall()) - } catch { + } catch let error { callStatus.pointee.code = CALL_UNEXPECTED_ERROR callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) } @@ -338,7 +339,7 @@ private func uniffiTraitInterfaceCall( private func uniffiTraitInterfaceCallWithError( callStatus: UnsafeMutablePointer, makeCall: () throws -> T, - writeReturn: (T) -> Void, + writeReturn: (T) -> (), lowerError: (E) -> RustBuffer ) { do { @@ -351,8 +352,7 @@ private func uniffiTraitInterfaceCallWithError( callStatus.pointee.errorBuf = FfiConverterString.lower(String(describing: error)) } } - -private class UniffiHandleMap { +fileprivate class UniffiHandleMap { private var map: [UInt64: T] = [:] private let lock = NSLock() private var currentHandle: UInt64 = 1 @@ -366,7 +366,7 @@ private class UniffiHandleMap { } } - func get(handle: UInt64) throws -> T { + func get(handle: UInt64) throws -> T { try lock.withLock { guard let obj = map[handle] else { throw UniffiInternalError.unexpectedStaleHandle @@ -386,21 +386,25 @@ private class UniffiHandleMap { } var count: Int { - map.count + get { + map.count + } } } + // Public interface members begin here. + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterUInt16: FfiConverterPrimitive { +fileprivate struct FfiConverterUInt16: FfiConverterPrimitive { typealias FfiType = UInt16 typealias SwiftType = UInt16 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt16 { - try lift(readInt(&buf)) + return try lift(readInt(&buf)) } public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -409,14 +413,14 @@ private struct FfiConverterUInt16: FfiConverterPrimitive { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterUInt32: FfiConverterPrimitive { +fileprivate struct FfiConverterUInt32: FfiConverterPrimitive { typealias FfiType = UInt32 typealias SwiftType = UInt32 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt32 { - try lift(readInt(&buf)) + return try lift(readInt(&buf)) } public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -425,14 +429,14 @@ private struct FfiConverterUInt32: FfiConverterPrimitive { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterUInt64: FfiConverterPrimitive { +fileprivate struct FfiConverterUInt64: FfiConverterPrimitive { typealias FfiType = UInt64 typealias SwiftType = UInt64 public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UInt64 { - try lift(readInt(&buf)) + return try lift(readInt(&buf)) } public static func write(_ value: SwiftType, into buf: inout [UInt8]) { @@ -441,14 +445,14 @@ private struct FfiConverterUInt64: FfiConverterPrimitive { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterDouble: FfiConverterPrimitive { +fileprivate struct FfiConverterDouble: FfiConverterPrimitive { typealias FfiType = Double typealias SwiftType = Double public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Double { - try lift(readDouble(&buf)) + return try lift(readDouble(&buf)) } public static func write(_ value: Double, into buf: inout [UInt8]) { @@ -457,22 +461,22 @@ private struct FfiConverterDouble: FfiConverterPrimitive { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterBool: FfiConverter { +fileprivate struct FfiConverterBool : FfiConverter { typealias FfiType = Int8 typealias SwiftType = Bool public static func lift(_ value: Int8) throws -> Bool { - value != 0 + return value != 0 } public static func lower(_ value: Bool) -> Int8 { - value ? 1 : 0 + return value ? 1 : 0 } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool { - try lift(readInt(&buf)) + return try lift(readInt(&buf)) } public static func write(_ value: Bool, into buf: inout [UInt8]) { @@ -481,9 +485,9 @@ private struct FfiConverterBool: FfiConverter { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterString: FfiConverter { +fileprivate struct FfiConverterString: FfiConverter { typealias SwiftType = String typealias FfiType = RustBuffer @@ -499,7 +503,7 @@ private struct FfiConverterString: FfiConverter { } public static func lower(_ value: String) -> RustBuffer { - value.utf8CString.withUnsafeBufferPointer { ptr in + return value.utf8CString.withUnsafeBufferPointer { ptr in // The swift string gives us int8_t, we want uint8_t. ptr.withMemoryRebound(to: UInt8.self) { ptr in // The swift string gives us a trailing null byte, we don't want it. @@ -511,7 +515,7 @@ private struct FfiConverterString: FfiConverter { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> String { let len: Int32 = try readInt(&buf) - return try String(bytes: readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! + return String(bytes: try readBytes(&buf, count: Int(len)), encoding: String.Encoding.utf8)! } public static func write(_ value: String, into buf: inout [UInt8]) { @@ -522,14 +526,14 @@ private struct FfiConverterString: FfiConverter { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterData: FfiConverterRustBuffer { +fileprivate struct FfiConverterData: FfiConverterRustBuffer { typealias SwiftType = Data public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Data { let len: Int32 = try readInt(&buf) - return try Data(readBytes(&buf, count: Int(len))) + return Data(try readBytes(&buf, count: Int(len))) } public static func write(_ value: Data, into buf: inout [UInt8]) { @@ -540,9 +544,9 @@ private struct FfiConverterData: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterTimestamp: FfiConverterRustBuffer { +fileprivate struct FfiConverterTimestamp: FfiConverterRustBuffer { typealias SwiftType = Date public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Date { @@ -550,10 +554,10 @@ private struct FfiConverterTimestamp: FfiConverterRustBuffer { let nanoseconds: UInt32 = try readInt(&buf) if seconds >= 0 { let delta = Double(seconds) + (Double(nanoseconds) / 1.0e9) - return Date(timeIntervalSince1970: delta) + return Date.init(timeIntervalSince1970: delta) } else { let delta = Double(seconds) - (Double(nanoseconds) / 1.0e9) - return Date(timeIntervalSince1970: delta) + return Date.init(timeIntervalSince1970: delta) } } @@ -577,6 +581,9 @@ private struct FfiConverterTimestamp: FfiConverterRustBuffer { } } + + + /** * Manages the navigation lifecycle through a route, * returning an updated state given inputs like user location. @@ -585,7 +592,8 @@ private struct FfiConverterTimestamp: FfiConverterRustBuffer { * - A controller is bound to a single route; if you want recalculation, create a new instance. * - This is a pure type (no interior mutability), so a core function of your platform code is responsibly managing mutable state. */ -public protocol NavigationControllerProtocol: AnyObject { +public protocol NavigationControllerProtocol : AnyObject { + /** * Advances navigation to the next step. * @@ -596,13 +604,13 @@ public protocol NavigationControllerProtocol: AnyObject { * This method is takes the intermediate state (e.g. from `update_user_location`) and advances if necessary. * As a result, you do not to re-calculate things like deviation or the snapped user location (search this file for usage of this function). */ - func advanceToNextStep(state: TripState) -> TripState - + func advanceToNextStep(state: TripState) -> TripState + /** * Returns initial trip state as if the user had just started the route with no progress. */ - func getInitialState(location: UserLocation) -> TripState - + func getInitialState(location: UserLocation) -> TripState + /** * Updates the user's current location and updates the navigation state accordingly. * @@ -611,7 +619,8 @@ public protocol NavigationControllerProtocol: AnyObject { * If there is no current step ([`TripState::Navigating`] has an empty `remainingSteps` value), * this function will panic. */ - func updateUserLocation(location: UserLocation, state: TripState) -> TripState + func updateUserLocation(location: UserLocation, state: TripState) -> TripState + } /** @@ -623,14 +632,13 @@ public protocol NavigationControllerProtocol: AnyObject { * - This is a pure type (no interior mutability), so a core function of your platform code is responsibly managing mutable state. */ open class NavigationController: - NavigationControllerProtocol -{ + NavigationControllerProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct NoPointer { public init() {} } @@ -638,53 +646,53 @@ open class NavigationController: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } // This constructor can be used to instantiate a fake object. - // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - // may be implemented for classes extending [FFIObject]. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. // // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - // isn't a backing [Pointer] the FFI lower functions will crash. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public init(noPointer _: NoPointer) { - pointer = nil - } - - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public func uniffiClonePointer() -> UnsafeMutableRawPointer { - try! rustCall { uniffi_ferrostar_fn_clone_navigationcontroller(self.pointer, $0) } + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public init(noPointer: NoPointer) { + self.pointer = nil } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public func uniffiClonePointer() -> UnsafeMutableRawPointer { + return try! rustCall { uniffi_ferrostar_fn_clone_navigationcontroller(self.pointer, $0) } + } /** * Create a navigation controller for a route and configuration. */ - public convenience init(route: Route, config: NavigationControllerConfig) { - let pointer = - try! rustCall { - uniffi_ferrostar_fn_constructor_navigationcontroller_new( - FfiConverterTypeRoute.lower(route), - FfiConverterTypeNavigationControllerConfig.lower(config), $0 - ) - } - self.init(unsafeFromRawPointer: pointer) - } +public convenience init(route: Route, config: NavigationControllerConfig) { + let pointer = + try! rustCall() { + uniffi_ferrostar_fn_constructor_navigationcontroller_new( + FfiConverterTypeRoute.lower(route), + FfiConverterTypeNavigationControllerConfig.lower(config),$0 + ) +} + self.init(unsafeFromRawPointer: pointer) +} deinit { - guard let pointer else { + guard let pointer = pointer else { return } try! rustCall { uniffi_ferrostar_fn_free_navigationcontroller(pointer, $0) } } + + + /** * Advances navigation to the next step. * @@ -695,25 +703,25 @@ open class NavigationController: * This method is takes the intermediate state (e.g. from `update_user_location`) and advances if necessary. * As a result, you do not to re-calculate things like deviation or the snapped user location (search this file for usage of this function). */ - open func advanceToNextStep(state: TripState) -> TripState { - try! FfiConverterTypeTripState.lift(try! rustCall { - uniffi_ferrostar_fn_method_navigationcontroller_advance_to_next_step(self.uniffiClonePointer(), - FfiConverterTypeTripState.lower(state), - $0) - }) - } - +open func advanceToNextStep(state: TripState) -> TripState { + return try! FfiConverterTypeTripState.lift(try! rustCall() { + uniffi_ferrostar_fn_method_navigationcontroller_advance_to_next_step(self.uniffiClonePointer(), + FfiConverterTypeTripState.lower(state),$0 + ) +}) +} + /** * Returns initial trip state as if the user had just started the route with no progress. */ - open func getInitialState(location: UserLocation) -> TripState { - try! FfiConverterTypeTripState.lift(try! rustCall { - uniffi_ferrostar_fn_method_navigationcontroller_get_initial_state(self.uniffiClonePointer(), - FfiConverterTypeUserLocation - .lower(location), $0) - }) - } - +open func getInitialState(location: UserLocation) -> TripState { + return try! FfiConverterTypeTripState.lift(try! rustCall() { + uniffi_ferrostar_fn_method_navigationcontroller_get_initial_state(self.uniffiClonePointer(), + FfiConverterTypeUserLocation.lower(location),$0 + ) +}) +} + /** * Updates the user's current location and updates the navigation state accordingly. * @@ -722,30 +730,32 @@ open class NavigationController: * If there is no current step ([`TripState::Navigating`] has an empty `remainingSteps` value), * this function will panic. */ - open func updateUserLocation(location: UserLocation, state: TripState) -> TripState { - try! FfiConverterTypeTripState.lift(try! rustCall { - uniffi_ferrostar_fn_method_navigationcontroller_update_user_location(self.uniffiClonePointer(), - FfiConverterTypeUserLocation - .lower(location), - FfiConverterTypeTripState.lower(state), - $0) - }) - } +open func updateUserLocation(location: UserLocation, state: TripState) -> TripState { + return try! FfiConverterTypeTripState.lift(try! rustCall() { + uniffi_ferrostar_fn_method_navigationcontroller_update_user_location(self.uniffiClonePointer(), + FfiConverterTypeUserLocation.lower(location), + FfiConverterTypeTripState.lower(state),$0 + ) +}) +} + + } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeNavigationController: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = NavigationController public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> NavigationController { - NavigationController(unsafeFromRawPointer: pointer) + return NavigationController(unsafeFromRawPointer: pointer) } public static func lower(_ value: NavigationController) -> UnsafeMutableRawPointer { - value.uniffiClonePointer() + return value.uniffiClonePointer() } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NavigationController { @@ -753,7 +763,7 @@ public struct FfiConverterTypeNavigationController: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -766,22 +776,26 @@ public struct FfiConverterTypeNavigationController: FfiConverter { } } + + + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -public func FfiConverterTypeNavigationController_lift(_ pointer: UnsafeMutableRawPointer) throws - -> NavigationController -{ - try FfiConverterTypeNavigationController.lift(pointer) +public func FfiConverterTypeNavigationController_lift(_ pointer: UnsafeMutableRawPointer) throws -> NavigationController { + return try FfiConverterTypeNavigationController.lift(pointer) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeNavigationController_lower(_ value: NavigationController) -> UnsafeMutableRawPointer { - FfiConverterTypeNavigationController.lower(value) + return FfiConverterTypeNavigationController.lower(value) } + + + /** * The route adapter bridges between the common core and a routing backend where interaction takes place * over a generic request/response flow (typically over a network; @@ -804,10 +818,12 @@ public func FfiConverterTypeNavigationController_lower(_ value: NavigationContro * is modularity, including the possibility of user-provided implementations, and these will not * always be of a "known" type to the Rust side. */ -public protocol RouteAdapterProtocol: AnyObject { - func generateRequest(userLocation: UserLocation, waypoints: [Waypoint]) throws -> RouteRequest - - func parseResponse(response: Data) throws -> [Route] +public protocol RouteAdapterProtocol : AnyObject { + + func generateRequest(userLocation: UserLocation, waypoints: [Waypoint]) throws -> RouteRequest + + func parseResponse(response: Data) throws -> [Route] + } /** @@ -833,14 +849,13 @@ public protocol RouteAdapterProtocol: AnyObject { * always be of a "known" type to the Rust side. */ open class RouteAdapter: - RouteAdapterProtocol -{ + RouteAdapterProtocol { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct NoPointer { public init() {} } @@ -848,92 +863,94 @@ open class RouteAdapter: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } // This constructor can be used to instantiate a fake object. - // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - // may be implemented for classes extending [FFIObject]. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. // // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - // isn't a backing [Pointer] the FFI lower functions will crash. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public init(noPointer _: NoPointer) { - pointer = nil - } - - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public func uniffiClonePointer() -> UnsafeMutableRawPointer { - try! rustCall { uniffi_ferrostar_fn_clone_routeadapter(self.pointer, $0) } + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public init(noPointer: NoPointer) { + self.pointer = nil } - public convenience init(requestGenerator: RouteRequestGenerator, responseParser: RouteResponseParser) { - let pointer = - try! rustCall { - uniffi_ferrostar_fn_constructor_routeadapter_new( - FfiConverterTypeRouteRequestGenerator.lower(requestGenerator), - FfiConverterTypeRouteResponseParser.lower(responseParser), $0 - ) - } - self.init(unsafeFromRawPointer: pointer) - } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public func uniffiClonePointer() -> UnsafeMutableRawPointer { + return try! rustCall { uniffi_ferrostar_fn_clone_routeadapter(self.pointer, $0) } + } +public convenience init(requestGenerator: RouteRequestGenerator, responseParser: RouteResponseParser) { + let pointer = + try! rustCall() { + uniffi_ferrostar_fn_constructor_routeadapter_new( + FfiConverterTypeRouteRequestGenerator.lower(requestGenerator), + FfiConverterTypeRouteResponseParser.lower(responseParser),$0 + ) +} + self.init(unsafeFromRawPointer: pointer) +} deinit { - guard let pointer else { + guard let pointer = pointer else { return } try! rustCall { uniffi_ferrostar_fn_free_routeadapter(pointer, $0) } } - public static func newValhallaHttp(endpointUrl: String, profile: String, - optionsJson: String?) throws -> RouteAdapter - { - try FfiConverterTypeRouteAdapter.lift(rustCallWithError(FfiConverterTypeInstantiationError.lift) { - uniffi_ferrostar_fn_constructor_routeadapter_new_valhalla_http( - FfiConverterString.lower(endpointUrl), - FfiConverterString.lower(profile), - FfiConverterOptionString.lower(optionsJson), $0 - ) - }) - } + +public static func newValhallaHttp(endpointUrl: String, profile: String, optionsJson: String?)throws -> RouteAdapter { + return try FfiConverterTypeRouteAdapter.lift(try rustCallWithError(FfiConverterTypeInstantiationError.lift) { + uniffi_ferrostar_fn_constructor_routeadapter_new_valhalla_http( + FfiConverterString.lower(endpointUrl), + FfiConverterString.lower(profile), + FfiConverterOptionString.lower(optionsJson),$0 + ) +}) +} + - open func generateRequest(userLocation: UserLocation, waypoints: [Waypoint]) throws -> RouteRequest { - try FfiConverterTypeRouteRequest.lift(rustCallWithError(FfiConverterTypeRoutingRequestGenerationError.lift) { - uniffi_ferrostar_fn_method_routeadapter_generate_request(self.uniffiClonePointer(), - FfiConverterTypeUserLocation.lower(userLocation), - FfiConverterSequenceTypeWaypoint.lower(waypoints), - $0) - }) - } + +open func generateRequest(userLocation: UserLocation, waypoints: [Waypoint])throws -> RouteRequest { + return try FfiConverterTypeRouteRequest.lift(try rustCallWithError(FfiConverterTypeRoutingRequestGenerationError.lift) { + uniffi_ferrostar_fn_method_routeadapter_generate_request(self.uniffiClonePointer(), + FfiConverterTypeUserLocation.lower(userLocation), + FfiConverterSequenceTypeWaypoint.lower(waypoints),$0 + ) +}) +} + +open func parseResponse(response: Data)throws -> [Route] { + return try FfiConverterSequenceTypeRoute.lift(try rustCallWithError(FfiConverterTypeParsingError.lift) { + uniffi_ferrostar_fn_method_routeadapter_parse_response(self.uniffiClonePointer(), + FfiConverterData.lower(response),$0 + ) +}) +} + - open func parseResponse(response: Data) throws -> [Route] { - try FfiConverterSequenceTypeRoute.lift(rustCallWithError(FfiConverterTypeParsingError.lift) { - uniffi_ferrostar_fn_method_routeadapter_parse_response(self.uniffiClonePointer(), - FfiConverterData.lower(response), $0) - }) - } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRouteAdapter: FfiConverter { + typealias FfiType = UnsafeMutableRawPointer typealias SwiftType = RouteAdapter public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteAdapter { - RouteAdapter(unsafeFromRawPointer: pointer) + return RouteAdapter(unsafeFromRawPointer: pointer) } public static func lower(_ value: RouteAdapter) -> UnsafeMutableRawPointer { - value.uniffiClonePointer() + return value.uniffiClonePointer() } public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteAdapter { @@ -941,7 +958,7 @@ public struct FfiConverterTypeRouteAdapter: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -954,20 +971,26 @@ public struct FfiConverterTypeRouteAdapter: FfiConverter { } } + + + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteAdapter_lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteAdapter { - try FfiConverterTypeRouteAdapter.lift(pointer) + return try FfiConverterTypeRouteAdapter.lift(pointer) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteAdapter_lower(_ value: RouteAdapter) -> UnsafeMutableRawPointer { - FfiConverterTypeRouteAdapter.lower(value) + return FfiConverterTypeRouteAdapter.lower(value) } + + + /** * A custom deviation detector (for extending the behavior of [`RouteDeviationTracking`]). * @@ -975,7 +998,8 @@ public func FfiConverterTypeRouteAdapter_lower(_ value: RouteAdapter) -> UnsafeM * For example, detecting that the user is proceeding the wrong direction by keeping a ring buffer * of recent locations, or perform local map matching. */ -public protocol RouteDeviationDetector: AnyObject { +public protocol RouteDeviationDetector : AnyObject { + /** * Determines whether the user is following the route correctly or not. * @@ -983,7 +1007,8 @@ public protocol RouteDeviationDetector: AnyObject { * Side-effects like whether to recalculate a route are left to higher levels, * and implementations should only be concerned with determining the facts. */ - func checkRouteDeviation(location: UserLocation, route: Route, currentRouteStep: RouteStep) -> RouteDeviation + func checkRouteDeviation(location: UserLocation, route: Route, currentRouteStep: RouteStep) -> RouteDeviation + } /** @@ -994,14 +1019,13 @@ public protocol RouteDeviationDetector: AnyObject { * of recent locations, or perform local map matching. */ open class RouteDeviationDetectorImpl: - RouteDeviationDetector -{ + RouteDeviationDetector { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct NoPointer { public init() {} } @@ -1009,41 +1033,41 @@ open class RouteDeviationDetectorImpl: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } // This constructor can be used to instantiate a fake object. - // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - // may be implemented for classes extending [FFIObject]. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. // // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - // isn't a backing [Pointer] the FFI lower functions will crash. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public init(noPointer _: NoPointer) { - pointer = nil - } - - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public func uniffiClonePointer() -> UnsafeMutableRawPointer { - try! rustCall { uniffi_ferrostar_fn_clone_routedeviationdetector(self.pointer, $0) } + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public init(noPointer: NoPointer) { + self.pointer = nil } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public func uniffiClonePointer() -> UnsafeMutableRawPointer { + return try! rustCall { uniffi_ferrostar_fn_clone_routedeviationdetector(self.pointer, $0) } + } // No primary constructor declared for this class. deinit { - guard let pointer else { + guard let pointer = pointer else { return } try! rustCall { uniffi_ferrostar_fn_free_routedeviationdetector(pointer, $0) } } + + + /** * Determines whether the user is following the route correctly or not. * @@ -1051,21 +1075,18 @@ open class RouteDeviationDetectorImpl: * Side-effects like whether to recalculate a route are left to higher levels, * and implementations should only be concerned with determining the facts. */ - open func checkRouteDeviation(location: UserLocation, route: Route, currentRouteStep: RouteStep) -> RouteDeviation { - try! FfiConverterTypeRouteDeviation.lift(try! rustCall { - uniffi_ferrostar_fn_method_routedeviationdetector_check_route_deviation(self.uniffiClonePointer(), - FfiConverterTypeUserLocation.lower( - location - ), - FfiConverterTypeRoute.lower(route), - FfiConverterTypeRouteStep.lower( - currentRouteStep - ), - $0) - }) - } +open func checkRouteDeviation(location: UserLocation, route: Route, currentRouteStep: RouteStep) -> RouteDeviation { + return try! FfiConverterTypeRouteDeviation.lift(try! rustCall() { + uniffi_ferrostar_fn_method_routedeviationdetector_check_route_deviation(self.uniffiClonePointer(), + FfiConverterTypeUserLocation.lower(location), + FfiConverterTypeRoute.lower(route), + FfiConverterTypeRouteStep.lower(currentRouteStep),$0 + ) +}) } + +} // Magic number for the Rust proxy to call using the same mechanism as every other method, // to free the callback once it's dropped by Rust. private let IDX_CALLBACK_FREE: Int32 = 0 @@ -1075,10 +1096,11 @@ private let UNIFFI_CALLBACK_ERROR: Int32 = 1 private let UNIFFI_CALLBACK_UNEXPECTED_ERROR: Int32 = 2 // Put the implementation in a struct so we don't pollute the top-level namespace -private enum UniffiCallbackInterfaceRouteDeviationDetector { +fileprivate struct UniffiCallbackInterfaceRouteDeviationDetector { + // Create the VTable using a series of closures. // Swift automatically converts these into C callback functions. - static var vtable: UniffiVTableCallbackInterfaceRouteDeviationDetector = .init( + static var vtable: UniffiVTableCallbackInterfaceRouteDeviationDetector = UniffiVTableCallbackInterfaceRouteDeviationDetector( checkRouteDeviation: { ( uniffiHandle: UInt64, location: RustBuffer, @@ -1089,17 +1111,17 @@ private enum UniffiCallbackInterfaceRouteDeviationDetector { ) in let makeCall = { () throws -> RouteDeviation in - guard let uniffiObj = try? FfiConverterTypeRouteDeviationDetector.handleMap.get(handle: uniffiHandle) - else { + guard let uniffiObj = try? FfiConverterTypeRouteDeviationDetector.handleMap.get(handle: uniffiHandle) else { throw UniffiInternalError.unexpectedStaleHandle } - return try uniffiObj.checkRouteDeviation( - location: FfiConverterTypeUserLocation.lift(location), - route: FfiConverterTypeRoute.lift(route), - currentRouteStep: FfiConverterTypeRouteStep.lift(currentRouteStep) + return uniffiObj.checkRouteDeviation( + location: try FfiConverterTypeUserLocation.lift(location), + route: try FfiConverterTypeRoute.lift(route), + currentRouteStep: try FfiConverterTypeRouteStep.lift(currentRouteStep) ) } + let writeReturn = { uniffiOutReturn.pointee = FfiConverterTypeRouteDeviation.lower($0) } uniffiTraitInterfaceCall( callStatus: uniffiCallStatus, @@ -1107,7 +1129,7 @@ private enum UniffiCallbackInterfaceRouteDeviationDetector { writeReturn: writeReturn ) }, - uniffiFree: { (uniffiHandle: UInt64) in + uniffiFree: { (uniffiHandle: UInt64) -> () in let result = try? FfiConverterTypeRouteDeviationDetector.handleMap.remove(handle: uniffiHandle) if result == nil { print("Uniffi callback interface RouteDeviationDetector: handle missing in uniffiFree") @@ -1117,12 +1139,11 @@ private enum UniffiCallbackInterfaceRouteDeviationDetector { } private func uniffiCallbackInitRouteDeviationDetector() { - uniffi_ferrostar_fn_init_callback_vtable_routedeviationdetector(&UniffiCallbackInterfaceRouteDeviationDetector - .vtable) + uniffi_ferrostar_fn_init_callback_vtable_routedeviationdetector(&UniffiCallbackInterfaceRouteDeviationDetector.vtable) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRouteDeviationDetector: FfiConverter { fileprivate static var handleMap = UniffiHandleMap() @@ -1131,12 +1152,11 @@ public struct FfiConverterTypeRouteDeviationDetector: FfiConverter { typealias SwiftType = RouteDeviationDetector public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteDeviationDetector { - RouteDeviationDetectorImpl(unsafeFromRawPointer: pointer) + return RouteDeviationDetectorImpl(unsafeFromRawPointer: pointer) } public static func lower(_ value: RouteDeviationDetector) -> UnsafeMutableRawPointer { - guard let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: handleMap.insert(obj: value))) - else { + guard let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: handleMap.insert(obj: value))) else { fatalError("Cast to UnsafeMutableRawPointer failed") } return ptr @@ -1147,7 +1167,7 @@ public struct FfiConverterTypeRouteDeviationDetector: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1160,22 +1180,26 @@ public struct FfiConverterTypeRouteDeviationDetector: FfiConverter { } } + + + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -public func FfiConverterTypeRouteDeviationDetector_lift(_ pointer: UnsafeMutableRawPointer) throws - -> RouteDeviationDetector -{ - try FfiConverterTypeRouteDeviationDetector.lift(pointer) +public func FfiConverterTypeRouteDeviationDetector_lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteDeviationDetector { + return try FfiConverterTypeRouteDeviationDetector.lift(pointer) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteDeviationDetector_lower(_ value: RouteDeviationDetector) -> UnsafeMutableRawPointer { - FfiConverterTypeRouteDeviationDetector.lower(value) + return FfiConverterTypeRouteDeviationDetector.lower(value) } + + + /** * A trait describing any object capable of generating [`RouteRequest`]s. * @@ -1187,14 +1211,16 @@ public func FfiConverterTypeRouteDeviationDetector_lower(_ value: RouteDeviation * Implementations may be either in Rust (most popular engines should eventually have Rust * glue code) or foreign code. */ -public protocol RouteRequestGenerator: AnyObject { +public protocol RouteRequestGenerator : AnyObject { + /** * Generates a routing backend request given the set of locations. * * While most implementations will treat the locations as an ordered sequence, this is not * guaranteed (ex: an optimized router). */ - func generateRequest(userLocation: UserLocation, waypoints: [Waypoint]) throws -> RouteRequest + func generateRequest(userLocation: UserLocation, waypoints: [Waypoint]) throws -> RouteRequest + } /** @@ -1209,14 +1235,13 @@ public protocol RouteRequestGenerator: AnyObject { * glue code) or foreign code. */ open class RouteRequestGeneratorImpl: - RouteRequestGenerator -{ + RouteRequestGenerator { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct NoPointer { public init() {} } @@ -1224,64 +1249,66 @@ open class RouteRequestGeneratorImpl: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } // This constructor can be used to instantiate a fake object. - // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - // may be implemented for classes extending [FFIObject]. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. // // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - // isn't a backing [Pointer] the FFI lower functions will crash. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public init(noPointer _: NoPointer) { - pointer = nil - } - - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public func uniffiClonePointer() -> UnsafeMutableRawPointer { - try! rustCall { uniffi_ferrostar_fn_clone_routerequestgenerator(self.pointer, $0) } + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public init(noPointer: NoPointer) { + self.pointer = nil } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public func uniffiClonePointer() -> UnsafeMutableRawPointer { + return try! rustCall { uniffi_ferrostar_fn_clone_routerequestgenerator(self.pointer, $0) } + } // No primary constructor declared for this class. deinit { - guard let pointer else { + guard let pointer = pointer else { return } try! rustCall { uniffi_ferrostar_fn_free_routerequestgenerator(pointer, $0) } } + + + /** * Generates a routing backend request given the set of locations. * * While most implementations will treat the locations as an ordered sequence, this is not * guaranteed (ex: an optimized router). */ - open func generateRequest(userLocation: UserLocation, waypoints: [Waypoint]) throws -> RouteRequest { - try FfiConverterTypeRouteRequest.lift(rustCallWithError(FfiConverterTypeRoutingRequestGenerationError.lift) { - uniffi_ferrostar_fn_method_routerequestgenerator_generate_request(self.uniffiClonePointer(), - FfiConverterTypeUserLocation - .lower(userLocation), - FfiConverterSequenceTypeWaypoint - .lower(waypoints), - $0) - }) - } +open func generateRequest(userLocation: UserLocation, waypoints: [Waypoint])throws -> RouteRequest { + return try FfiConverterTypeRouteRequest.lift(try rustCallWithError(FfiConverterTypeRoutingRequestGenerationError.lift) { + uniffi_ferrostar_fn_method_routerequestgenerator_generate_request(self.uniffiClonePointer(), + FfiConverterTypeUserLocation.lower(userLocation), + FfiConverterSequenceTypeWaypoint.lower(waypoints),$0 + ) +}) +} + + } + // Put the implementation in a struct so we don't pollute the top-level namespace -private enum UniffiCallbackInterfaceRouteRequestGenerator { +fileprivate struct UniffiCallbackInterfaceRouteRequestGenerator { + // Create the VTable using a series of closures. // Swift automatically converts these into C callback functions. - static var vtable: UniffiVTableCallbackInterfaceRouteRequestGenerator = .init( + static var vtable: UniffiVTableCallbackInterfaceRouteRequestGenerator = UniffiVTableCallbackInterfaceRouteRequestGenerator( generateRequest: { ( uniffiHandle: UInt64, userLocation: RustBuffer, @@ -1291,16 +1318,16 @@ private enum UniffiCallbackInterfaceRouteRequestGenerator { ) in let makeCall = { () throws -> RouteRequest in - guard let uniffiObj = try? FfiConverterTypeRouteRequestGenerator.handleMap.get(handle: uniffiHandle) - else { + guard let uniffiObj = try? FfiConverterTypeRouteRequestGenerator.handleMap.get(handle: uniffiHandle) else { throw UniffiInternalError.unexpectedStaleHandle } return try uniffiObj.generateRequest( - userLocation: FfiConverterTypeUserLocation.lift(userLocation), - waypoints: FfiConverterSequenceTypeWaypoint.lift(waypoints) + userLocation: try FfiConverterTypeUserLocation.lift(userLocation), + waypoints: try FfiConverterSequenceTypeWaypoint.lift(waypoints) ) } + let writeReturn = { uniffiOutReturn.pointee = FfiConverterTypeRouteRequest.lower($0) } uniffiTraitInterfaceCallWithError( callStatus: uniffiCallStatus, @@ -1309,7 +1336,7 @@ private enum UniffiCallbackInterfaceRouteRequestGenerator { lowerError: FfiConverterTypeRoutingRequestGenerationError.lower ) }, - uniffiFree: { (uniffiHandle: UInt64) in + uniffiFree: { (uniffiHandle: UInt64) -> () in let result = try? FfiConverterTypeRouteRequestGenerator.handleMap.remove(handle: uniffiHandle) if result == nil { print("Uniffi callback interface RouteRequestGenerator: handle missing in uniffiFree") @@ -1323,7 +1350,7 @@ private func uniffiCallbackInitRouteRequestGenerator() { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRouteRequestGenerator: FfiConverter { fileprivate static var handleMap = UniffiHandleMap() @@ -1332,12 +1359,11 @@ public struct FfiConverterTypeRouteRequestGenerator: FfiConverter { typealias SwiftType = RouteRequestGenerator public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteRequestGenerator { - RouteRequestGeneratorImpl(unsafeFromRawPointer: pointer) + return RouteRequestGeneratorImpl(unsafeFromRawPointer: pointer) } public static func lower(_ value: RouteRequestGenerator) -> UnsafeMutableRawPointer { - guard let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: handleMap.insert(obj: value))) - else { + guard let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: handleMap.insert(obj: value))) else { fatalError("Cast to UnsafeMutableRawPointer failed") } return ptr @@ -1348,7 +1374,7 @@ public struct FfiConverterTypeRouteRequestGenerator: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1361,34 +1387,40 @@ public struct FfiConverterTypeRouteRequestGenerator: FfiConverter { } } + + + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -public func FfiConverterTypeRouteRequestGenerator_lift(_ pointer: UnsafeMutableRawPointer) throws - -> RouteRequestGenerator -{ - try FfiConverterTypeRouteRequestGenerator.lift(pointer) +public func FfiConverterTypeRouteRequestGenerator_lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteRequestGenerator { + return try FfiConverterTypeRouteRequestGenerator.lift(pointer) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteRequestGenerator_lower(_ value: RouteRequestGenerator) -> UnsafeMutableRawPointer { - FfiConverterTypeRouteRequestGenerator.lower(value) + return FfiConverterTypeRouteRequestGenerator.lower(value) } + + + /** * A generic interface describing any object capable of parsing a response from a routing * backend into one or more [`Route`]s. */ -public protocol RouteResponseParser: AnyObject { +public protocol RouteResponseParser : AnyObject { + /** * Parses a raw response from the routing backend into a route. * * We use a sequence of octets as a common interchange format. * as this works for all currently conceivable formats (JSON, PBF, etc.). */ - func parseResponse(response: Data) throws -> [Route] + func parseResponse(response: Data) throws -> [Route] + } /** @@ -1396,14 +1428,13 @@ public protocol RouteResponseParser: AnyObject { * backend into one or more [`Route`]s. */ open class RouteResponseParserImpl: - RouteResponseParser -{ + RouteResponseParser { fileprivate let pointer: UnsafeMutableRawPointer! /// Used to instantiate a [FFIObject] without an actual pointer, for fakes in tests, mostly. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif +#if swift(>=5.8) + @_documentation(visibility: private) +#endif public struct NoPointer { public init() {} } @@ -1411,60 +1442,65 @@ open class RouteResponseParserImpl: // TODO: We'd like this to be `private` but for Swifty reasons, // we can't implement `FfiConverter` without making this `required` and we can't // make it `required` without making it `public`. - public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { + required public init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) { self.pointer = pointer } // This constructor can be used to instantiate a fake object. - // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that - // may be implemented for classes extending [FFIObject]. + // - Parameter noPointer: Placeholder value so we can have a constructor separate from the default empty one that may be implemented for classes extending [FFIObject]. // // - Warning: - // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there - // isn't a backing [Pointer] the FFI lower functions will crash. - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public init(noPointer _: NoPointer) { - pointer = nil - } - - #if swift(>=5.8) - @_documentation(visibility: private) - #endif - public func uniffiClonePointer() -> UnsafeMutableRawPointer { - try! rustCall { uniffi_ferrostar_fn_clone_routeresponseparser(self.pointer, $0) } + // Any object instantiated with this constructor cannot be passed to an actual Rust-backed object. Since there isn't a backing [Pointer] the FFI lower functions will crash. +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public init(noPointer: NoPointer) { + self.pointer = nil } +#if swift(>=5.8) + @_documentation(visibility: private) +#endif + public func uniffiClonePointer() -> UnsafeMutableRawPointer { + return try! rustCall { uniffi_ferrostar_fn_clone_routeresponseparser(self.pointer, $0) } + } // No primary constructor declared for this class. deinit { - guard let pointer else { + guard let pointer = pointer else { return } try! rustCall { uniffi_ferrostar_fn_free_routeresponseparser(pointer, $0) } } + + + /** * Parses a raw response from the routing backend into a route. * * We use a sequence of octets as a common interchange format. * as this works for all currently conceivable formats (JSON, PBF, etc.). */ - open func parseResponse(response: Data) throws -> [Route] { - try FfiConverterSequenceTypeRoute.lift(rustCallWithError(FfiConverterTypeParsingError.lift) { - uniffi_ferrostar_fn_method_routeresponseparser_parse_response(self.uniffiClonePointer(), - FfiConverterData.lower(response), $0) - }) - } +open func parseResponse(response: Data)throws -> [Route] { + return try FfiConverterSequenceTypeRoute.lift(try rustCallWithError(FfiConverterTypeParsingError.lift) { + uniffi_ferrostar_fn_method_routeresponseparser_parse_response(self.uniffiClonePointer(), + FfiConverterData.lower(response),$0 + ) +}) +} + + } + // Put the implementation in a struct so we don't pollute the top-level namespace -private enum UniffiCallbackInterfaceRouteResponseParser { +fileprivate struct UniffiCallbackInterfaceRouteResponseParser { + // Create the VTable using a series of closures. // Swift automatically converts these into C callback functions. - static var vtable: UniffiVTableCallbackInterfaceRouteResponseParser = .init( + static var vtable: UniffiVTableCallbackInterfaceRouteResponseParser = UniffiVTableCallbackInterfaceRouteResponseParser( parseResponse: { ( uniffiHandle: UInt64, response: RustBuffer, @@ -1473,15 +1509,15 @@ private enum UniffiCallbackInterfaceRouteResponseParser { ) in let makeCall = { () throws -> [Route] in - guard let uniffiObj = try? FfiConverterTypeRouteResponseParser.handleMap.get(handle: uniffiHandle) - else { + guard let uniffiObj = try? FfiConverterTypeRouteResponseParser.handleMap.get(handle: uniffiHandle) else { throw UniffiInternalError.unexpectedStaleHandle } return try uniffiObj.parseResponse( - response: FfiConverterData.lift(response) + response: try FfiConverterData.lift(response) ) } + let writeReturn = { uniffiOutReturn.pointee = FfiConverterSequenceTypeRoute.lower($0) } uniffiTraitInterfaceCallWithError( callStatus: uniffiCallStatus, @@ -1490,7 +1526,7 @@ private enum UniffiCallbackInterfaceRouteResponseParser { lowerError: FfiConverterTypeParsingError.lower ) }, - uniffiFree: { (uniffiHandle: UInt64) in + uniffiFree: { (uniffiHandle: UInt64) -> () in let result = try? FfiConverterTypeRouteResponseParser.handleMap.remove(handle: uniffiHandle) if result == nil { print("Uniffi callback interface RouteResponseParser: handle missing in uniffiFree") @@ -1504,7 +1540,7 @@ private func uniffiCallbackInitRouteResponseParser() { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRouteResponseParser: FfiConverter { fileprivate static var handleMap = UniffiHandleMap() @@ -1513,12 +1549,11 @@ public struct FfiConverterTypeRouteResponseParser: FfiConverter { typealias SwiftType = RouteResponseParser public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteResponseParser { - RouteResponseParserImpl(unsafeFromRawPointer: pointer) + return RouteResponseParserImpl(unsafeFromRawPointer: pointer) } public static func lower(_ value: RouteResponseParser) -> UnsafeMutableRawPointer { - guard let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: handleMap.insert(obj: value))) - else { + guard let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: handleMap.insert(obj: value))) else { fatalError("Cast to UnsafeMutableRawPointer failed") } return ptr @@ -1529,7 +1564,7 @@ public struct FfiConverterTypeRouteResponseParser: FfiConverter { // The Rust code won't compile if a pointer won't fit in a UInt64. // We have to go via `UInt` because that's the thing that's the size of a pointer. let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v)) - if ptr == nil { + if (ptr == nil) { throw UniffiInternalError.unexpectedNullPointer } return try lift(ptr!) @@ -1542,20 +1577,24 @@ public struct FfiConverterTypeRouteResponseParser: FfiConverter { } } + + + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteResponseParser_lift(_ pointer: UnsafeMutableRawPointer) throws -> RouteResponseParser { - try FfiConverterTypeRouteResponseParser.lift(pointer) + return try FfiConverterTypeRouteResponseParser.lift(pointer) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteResponseParser_lower(_ value: RouteResponseParser) -> UnsafeMutableRawPointer { - FfiConverterTypeRouteResponseParser.lower(value) + return FfiConverterTypeRouteResponseParser.lower(value) } + /** * A geographic bounding box defined by its corners. */ @@ -1574,18 +1613,19 @@ public struct BoundingBox { public init( /** * The southwest corner of the bounding box. - */ sw: GeographicCoordinate, + */sw: GeographicCoordinate, /** - * The northeast corner of the bounding box. - */ ne: GeographicCoordinate - ) { + * The northeast corner of the bounding box. + */ne: GeographicCoordinate) { self.sw = sw self.ne = ne } } + + extension BoundingBox: Equatable, Hashable { - public static func == (lhs: BoundingBox, rhs: BoundingBox) -> Bool { + public static func ==(lhs: BoundingBox, rhs: BoundingBox) -> Bool { if lhs.sw != rhs.sw { return false } @@ -1601,14 +1641,16 @@ extension BoundingBox: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeBoundingBox: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> BoundingBox { - try BoundingBox( - sw: FfiConverterTypeGeographicCoordinate.read(from: &buf), - ne: FfiConverterTypeGeographicCoordinate.read(from: &buf) + return + try BoundingBox( + sw: FfiConverterTypeGeographicCoordinate.read(from: &buf), + ne: FfiConverterTypeGeographicCoordinate.read(from: &buf) ) } @@ -1618,20 +1660,22 @@ public struct FfiConverterTypeBoundingBox: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeBoundingBox_lift(_ buf: RustBuffer) throws -> BoundingBox { - try FfiConverterTypeBoundingBox.lift(buf) + return try FfiConverterTypeBoundingBox.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeBoundingBox_lower(_ value: BoundingBox) -> RustBuffer { - FfiConverterTypeBoundingBox.lower(value) + return FfiConverterTypeBoundingBox.lower(value) } + /** * The direction in which the user/device is observed to be traveling. */ @@ -1652,18 +1696,19 @@ public struct CourseOverGround { /** * The direction in which the user's device is traveling, measured in clockwise degrees from * true north (N = 0, E = 90, S = 180, W = 270). - */ degrees: UInt16, + */degrees: UInt16, /** - * The accuracy of the course value, measured in degrees. - */ accuracy: UInt16? - ) { + * The accuracy of the course value, measured in degrees. + */accuracy: UInt16?) { self.degrees = degrees self.accuracy = accuracy } } + + extension CourseOverGround: Equatable, Hashable { - public static func == (lhs: CourseOverGround, rhs: CourseOverGround) -> Bool { + public static func ==(lhs: CourseOverGround, rhs: CourseOverGround) -> Bool { if lhs.degrees != rhs.degrees { return false } @@ -1679,14 +1724,16 @@ extension CourseOverGround: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeCourseOverGround: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CourseOverGround { - try CourseOverGround( - degrees: FfiConverterUInt16.read(from: &buf), - accuracy: FfiConverterOptionUInt16.read(from: &buf) + return + try CourseOverGround( + degrees: FfiConverterUInt16.read(from: &buf), + accuracy: FfiConverterOptionUInt16.read(from: &buf) ) } @@ -1696,20 +1743,22 @@ public struct FfiConverterTypeCourseOverGround: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeCourseOverGround_lift(_ buf: RustBuffer) throws -> CourseOverGround { - try FfiConverterTypeCourseOverGround.lift(buf) + return try FfiConverterTypeCourseOverGround.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeCourseOverGround_lower(_ value: CourseOverGround) -> RustBuffer { - FfiConverterTypeCourseOverGround.lower(value) + return FfiConverterTypeCourseOverGround.lower(value) } + /** * A geographic coordinate in WGS84. */ @@ -1728,18 +1777,19 @@ public struct GeographicCoordinate { public init( /** * The latitude (in degrees). - */ lat: Double, + */lat: Double, /** - * The Longitude (in degrees). - */ lng: Double - ) { + * The Longitude (in degrees). + */lng: Double) { self.lat = lat self.lng = lng } } + + extension GeographicCoordinate: Equatable, Hashable { - public static func == (lhs: GeographicCoordinate, rhs: GeographicCoordinate) -> Bool { + public static func ==(lhs: GeographicCoordinate, rhs: GeographicCoordinate) -> Bool { if lhs.lat != rhs.lat { return false } @@ -1755,14 +1805,16 @@ extension GeographicCoordinate: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeGeographicCoordinate: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> GeographicCoordinate { - try GeographicCoordinate( - lat: FfiConverterDouble.read(from: &buf), - lng: FfiConverterDouble.read(from: &buf) + return + try GeographicCoordinate( + lat: FfiConverterDouble.read(from: &buf), + lng: FfiConverterDouble.read(from: &buf) ) } @@ -1772,20 +1824,22 @@ public struct FfiConverterTypeGeographicCoordinate: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeGeographicCoordinate_lift(_ buf: RustBuffer) throws -> GeographicCoordinate { - try FfiConverterTypeGeographicCoordinate.lift(buf) + return try FfiConverterTypeGeographicCoordinate.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeGeographicCoordinate_lower(_ value: GeographicCoordinate) -> RustBuffer { - FfiConverterTypeGeographicCoordinate.lower(value) + return FfiConverterTypeGeographicCoordinate.lower(value) } + /** * The heading of the user/device. */ @@ -1808,22 +1862,23 @@ public struct Heading { public init( /** * The heading in degrees relative to true north. - */ trueHeading: UInt16, + */trueHeading: UInt16, /** - * The platform specific accuracy of the heading value. - */ accuracy: UInt16, + * The platform specific accuracy of the heading value. + */accuracy: UInt16, /** - * The time at which the heading was recorded. - */ timestamp: Date - ) { + * The time at which the heading was recorded. + */timestamp: Date) { self.trueHeading = trueHeading self.accuracy = accuracy self.timestamp = timestamp } } + + extension Heading: Equatable, Hashable { - public static func == (lhs: Heading, rhs: Heading) -> Bool { + public static func ==(lhs: Heading, rhs: Heading) -> Bool { if lhs.trueHeading != rhs.trueHeading { return false } @@ -1843,15 +1898,17 @@ extension Heading: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeHeading: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Heading { - try Heading( - trueHeading: FfiConverterUInt16.read(from: &buf), - accuracy: FfiConverterUInt16.read(from: &buf), - timestamp: FfiConverterTimestamp.read(from: &buf) + return + try Heading( + trueHeading: FfiConverterUInt16.read(from: &buf), + accuracy: FfiConverterUInt16.read(from: &buf), + timestamp: FfiConverterTimestamp.read(from: &buf) ) } @@ -1862,20 +1919,22 @@ public struct FfiConverterTypeHeading: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeHeading_lift(_ buf: RustBuffer) throws -> Heading { - try FfiConverterTypeHeading.lift(buf) + return try FfiConverterTypeHeading.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeHeading_lower(_ value: Heading) -> RustBuffer { - FfiConverterTypeHeading.lower(value) + return FfiConverterTypeHeading.lower(value) } + /** * The content of a visual instruction. */ @@ -1893,8 +1952,10 @@ public struct LaneInfo { } } + + extension LaneInfo: Equatable, Hashable { - public static func == (lhs: LaneInfo, rhs: LaneInfo) -> Bool { + public static func ==(lhs: LaneInfo, rhs: LaneInfo) -> Bool { if lhs.active != rhs.active { return false } @@ -1914,15 +1975,17 @@ extension LaneInfo: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeLaneInfo: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LaneInfo { - try LaneInfo( - active: FfiConverterBool.read(from: &buf), - directions: FfiConverterSequenceString.read(from: &buf), - activeDirection: FfiConverterOptionString.read(from: &buf) + return + try LaneInfo( + active: FfiConverterBool.read(from: &buf), + directions: FfiConverterSequenceString.read(from: &buf), + activeDirection: FfiConverterOptionString.read(from: &buf) ) } @@ -1933,20 +1996,22 @@ public struct FfiConverterTypeLaneInfo: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeLaneInfo_lift(_ buf: RustBuffer) throws -> LaneInfo { - try FfiConverterTypeLaneInfo.lift(buf) + return try FfiConverterTypeLaneInfo.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeLaneInfo_lower(_ value: LaneInfo) -> RustBuffer { - FfiConverterTypeLaneInfo.lower(value) + return FfiConverterTypeLaneInfo.lower(value) } + /** * The current state of the simulation. */ @@ -1964,8 +2029,10 @@ public struct LocationSimulationState { } } + + extension LocationSimulationState: Equatable, Hashable { - public static func == (lhs: LocationSimulationState, rhs: LocationSimulationState) -> Bool { + public static func ==(lhs: LocationSimulationState, rhs: LocationSimulationState) -> Bool { if lhs.currentLocation != rhs.currentLocation { return false } @@ -1985,15 +2052,17 @@ extension LocationSimulationState: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeLocationSimulationState: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LocationSimulationState { - try LocationSimulationState( - currentLocation: FfiConverterTypeUserLocation.read(from: &buf), - remainingLocations: FfiConverterSequenceTypeGeographicCoordinate.read(from: &buf), - bias: FfiConverterTypeLocationBias.read(from: &buf) + return + try LocationSimulationState( + currentLocation: FfiConverterTypeUserLocation.read(from: &buf), + remainingLocations: FfiConverterSequenceTypeGeographicCoordinate.read(from: &buf), + bias: FfiConverterTypeLocationBias.read(from: &buf) ) } @@ -2004,20 +2073,22 @@ public struct FfiConverterTypeLocationSimulationState: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeLocationSimulationState_lift(_ buf: RustBuffer) throws -> LocationSimulationState { - try FfiConverterTypeLocationSimulationState.lift(buf) + return try FfiConverterTypeLocationSimulationState.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeLocationSimulationState_lower(_ value: LocationSimulationState) -> RustBuffer { - FfiConverterTypeLocationSimulationState.lower(value) + return FfiConverterTypeLocationSimulationState.lower(value) } + public struct NavigationControllerConfig { /** * Configures when navigation advances to the next step in the route. @@ -2040,32 +2111,34 @@ public struct NavigationControllerConfig { public init( /** * Configures when navigation advances to the next step in the route. - */ stepAdvance: StepAdvanceMode, + */stepAdvance: StepAdvanceMode, /** - * Configures when the user is deemed to be off course. - * - * NOTE: This is distinct from the action that is taken. - * It is only the determination that the user has deviated from the expected route. - */ routeDeviationTracking: RouteDeviationTracking, + * Configures when the user is deemed to be off course. + * + * NOTE: This is distinct from the action that is taken. + * It is only the determination that the user has deviated from the expected route. + */routeDeviationTracking: RouteDeviationTracking, /** - * Configures how the heading component of the snapped location is reported in [`TripState`]. - */ snappedLocationCourseFiltering: CourseFiltering - ) { + * Configures how the heading component of the snapped location is reported in [`TripState`]. + */snappedLocationCourseFiltering: CourseFiltering) { self.stepAdvance = stepAdvance self.routeDeviationTracking = routeDeviationTracking self.snappedLocationCourseFiltering = snappedLocationCourseFiltering } } + + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeNavigationControllerConfig: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> NavigationControllerConfig { - try NavigationControllerConfig( - stepAdvance: FfiConverterTypeStepAdvanceMode.read(from: &buf), - routeDeviationTracking: FfiConverterTypeRouteDeviationTracking.read(from: &buf), - snappedLocationCourseFiltering: FfiConverterTypeCourseFiltering.read(from: &buf) + return + try NavigationControllerConfig( + stepAdvance: FfiConverterTypeStepAdvanceMode.read(from: &buf), + routeDeviationTracking: FfiConverterTypeRouteDeviationTracking.read(from: &buf), + snappedLocationCourseFiltering: FfiConverterTypeCourseFiltering.read(from: &buf) ) } @@ -2076,20 +2149,22 @@ public struct FfiConverterTypeNavigationControllerConfig: FfiConverterRustBuffer } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeNavigationControllerConfig_lift(_ buf: RustBuffer) throws -> NavigationControllerConfig { - try FfiConverterTypeNavigationControllerConfig.lift(buf) + return try FfiConverterTypeNavigationControllerConfig.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeNavigationControllerConfig_lower(_ value: NavigationControllerConfig) -> RustBuffer { - FfiConverterTypeNavigationControllerConfig.lower(value) + return FfiConverterTypeNavigationControllerConfig.lower(value) } + /** * Information describing the series of steps needed to travel between two or more points. * @@ -2113,16 +2188,15 @@ public struct Route { // Default memberwise initializers are never public by default, so we // declare one manually. - public init(geometry: [GeographicCoordinate], bbox: BoundingBox, - /** - * The total route distance, in meters. - */ distance: Double, - /** - * The ordered list of waypoints to visit, including the starting point. - * Note that this is distinct from the *geometry* which includes all points visited. - * A waypoint represents a start/end point for a route leg. - */ waypoints: [Waypoint], steps: [RouteStep]) - { + public init(geometry: [GeographicCoordinate], bbox: BoundingBox, + /** + * The total route distance, in meters. + */distance: Double, + /** + * The ordered list of waypoints to visit, including the starting point. + * Note that this is distinct from the *geometry* which includes all points visited. + * A waypoint represents a start/end point for a route leg. + */waypoints: [Waypoint], steps: [RouteStep]) { self.geometry = geometry self.bbox = bbox self.distance = distance @@ -2131,8 +2205,10 @@ public struct Route { } } + + extension Route: Equatable, Hashable { - public static func == (lhs: Route, rhs: Route) -> Bool { + public static func ==(lhs: Route, rhs: Route) -> Bool { if lhs.geometry != rhs.geometry { return false } @@ -2160,17 +2236,19 @@ extension Route: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRoute: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Route { - try Route( - geometry: FfiConverterSequenceTypeGeographicCoordinate.read(from: &buf), - bbox: FfiConverterTypeBoundingBox.read(from: &buf), - distance: FfiConverterDouble.read(from: &buf), - waypoints: FfiConverterSequenceTypeWaypoint.read(from: &buf), - steps: FfiConverterSequenceTypeRouteStep.read(from: &buf) + return + try Route( + geometry: FfiConverterSequenceTypeGeographicCoordinate.read(from: &buf), + bbox: FfiConverterTypeBoundingBox.read(from: &buf), + distance: FfiConverterDouble.read(from: &buf), + waypoints: FfiConverterSequenceTypeWaypoint.read(from: &buf), + steps: FfiConverterSequenceTypeRouteStep.read(from: &buf) ) } @@ -2183,20 +2261,22 @@ public struct FfiConverterTypeRoute: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRoute_lift(_ buf: RustBuffer) throws -> Route { - try FfiConverterTypeRoute.lift(buf) + return try FfiConverterTypeRoute.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRoute_lower(_ value: Route) -> RustBuffer { - FfiConverterTypeRoute.lower(value) + return FfiConverterTypeRoute.lower(value) } + /** * A maneuver (such as a turn or merge) followed by travel of a certain distance until reaching * the next step. @@ -2244,33 +2324,32 @@ public struct RouteStep { public init( /** * The full route geometry for this step. - */ geometry: [GeographicCoordinate], + */geometry: [GeographicCoordinate], /** - * The distance, in meters, to travel along the route after the maneuver to reach the next step. - */ distance: Double, + * The distance, in meters, to travel along the route after the maneuver to reach the next step. + */distance: Double, /** - * The estimated duration, in seconds, that it will take to complete this step. - */ duration: Double, + * The estimated duration, in seconds, that it will take to complete this step. + */duration: Double, /** - * The name of the road being traveled on (useful for certain UI styles). - */ roadName: String?, + * The name of the road being traveled on (useful for certain UI styles). + */roadName: String?, /** - * A description of the maneuver (ex: "Turn wright onto main street"). - * - * Note for UI implementers: the context this appears in (or doesn't) - * depends somewhat on your use case and routing engine. - * For example, this field is useful as a written instruction in Valhalla. - */ instruction: String, + * A description of the maneuver (ex: "Turn wright onto main street"). + * + * Note for UI implementers: the context this appears in (or doesn't) + * depends somewhat on your use case and routing engine. + * For example, this field is useful as a written instruction in Valhalla. + */instruction: String, /** - * A list of instructions for visual display (usually as banners) at specific points along the step. - */ visualInstructions: [VisualInstruction], + * A list of instructions for visual display (usually as banners) at specific points along the step. + */visualInstructions: [VisualInstruction], /** - * A list of prompts to announce (via speech synthesis) at specific points along the step. - */ spokenInstructions: [SpokenInstruction], + * A list of prompts to announce (via speech synthesis) at specific points along the step. + */spokenInstructions: [SpokenInstruction], /** - * A list of json encoded strings representing annotations between each coordinate along the step. - */ annotations: [String]? - ) { + * A list of json encoded strings representing annotations between each coordinate along the step. + */annotations: [String]?) { self.geometry = geometry self.distance = distance self.duration = duration @@ -2282,8 +2361,10 @@ public struct RouteStep { } } + + extension RouteStep: Equatable, Hashable { - public static func == (lhs: RouteStep, rhs: RouteStep) -> Bool { + public static func ==(lhs: RouteStep, rhs: RouteStep) -> Bool { if lhs.geometry != rhs.geometry { return false } @@ -2323,20 +2404,22 @@ extension RouteStep: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRouteStep: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteStep { - try RouteStep( - geometry: FfiConverterSequenceTypeGeographicCoordinate.read(from: &buf), - distance: FfiConverterDouble.read(from: &buf), - duration: FfiConverterDouble.read(from: &buf), - roadName: FfiConverterOptionString.read(from: &buf), - instruction: FfiConverterString.read(from: &buf), - visualInstructions: FfiConverterSequenceTypeVisualInstruction.read(from: &buf), - spokenInstructions: FfiConverterSequenceTypeSpokenInstruction.read(from: &buf), - annotations: FfiConverterOptionSequenceString.read(from: &buf) + return + try RouteStep( + geometry: FfiConverterSequenceTypeGeographicCoordinate.read(from: &buf), + distance: FfiConverterDouble.read(from: &buf), + duration: FfiConverterDouble.read(from: &buf), + roadName: FfiConverterOptionString.read(from: &buf), + instruction: FfiConverterString.read(from: &buf), + visualInstructions: FfiConverterSequenceTypeVisualInstruction.read(from: &buf), + spokenInstructions: FfiConverterSequenceTypeSpokenInstruction.read(from: &buf), + annotations: FfiConverterOptionSequenceString.read(from: &buf) ) } @@ -2352,20 +2435,22 @@ public struct FfiConverterTypeRouteStep: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteStep_lift(_ buf: RustBuffer) throws -> RouteStep { - try FfiConverterTypeRouteStep.lift(buf) + return try FfiConverterTypeRouteStep.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteStep_lower(_ value: RouteStep) -> RustBuffer { - FfiConverterTypeRouteStep.lower(value) + return FfiConverterTypeRouteStep.lower(value) } + /** * The speed of the user from the location provider. */ @@ -2384,18 +2469,19 @@ public struct Speed { public init( /** * The user's speed in meters per second. - */ value: Double, + */value: Double, /** - * The accuracy of the speed value, measured in meters per second. - */ accuracy: Double? - ) { + * The accuracy of the speed value, measured in meters per second. + */accuracy: Double?) { self.value = value self.accuracy = accuracy } } + + extension Speed: Equatable, Hashable { - public static func == (lhs: Speed, rhs: Speed) -> Bool { + public static func ==(lhs: Speed, rhs: Speed) -> Bool { if lhs.value != rhs.value { return false } @@ -2411,14 +2497,16 @@ extension Speed: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeSpeed: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Speed { - try Speed( - value: FfiConverterDouble.read(from: &buf), - accuracy: FfiConverterOptionDouble.read(from: &buf) + return + try Speed( + value: FfiConverterDouble.read(from: &buf), + accuracy: FfiConverterOptionDouble.read(from: &buf) ) } @@ -2428,20 +2516,22 @@ public struct FfiConverterTypeSpeed: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeSpeed_lift(_ buf: RustBuffer) throws -> Speed { - try FfiConverterTypeSpeed.lift(buf) + return try FfiConverterTypeSpeed.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeSpeed_lower(_ value: Speed) -> RustBuffer { - FfiConverterTypeSpeed.lower(value) + return FfiConverterTypeSpeed.lower(value) } + /** * An instruction that can be synthesized using a TTS engine to announce an upcoming maneuver. * @@ -2477,24 +2567,23 @@ public struct SpokenInstruction { public init( /** * Plain-text instruction which can be synthesized with a TTS engine. - */ text: String, + */text: String, /** - * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it. - */ ssml: String?, + * Speech Synthesis Markup Language, which should be preferred by clients capable of understanding it. + */ssml: String?, /** - * How far (in meters) from the upcoming maneuver the instruction should start being displayed - */ triggerDistanceBeforeManeuver: Double, + * How far (in meters) from the upcoming maneuver the instruction should start being displayed + */triggerDistanceBeforeManeuver: Double, /** - * A unique identifier for this instruction. - * - * This is provided so that platform-layer integrations can easily disambiguate between distinct utterances, - * which may have the same textual content. - * UUIDs conveniently fill this purpose. - * - * NOTE: While it is possible to deterministically create UUIDs, we do not do so at this time. - * This should be theoretically possible though if someone cares to write up a proposal and a PR. - */ utteranceId: Uuid - ) { + * A unique identifier for this instruction. + * + * This is provided so that platform-layer integrations can easily disambiguate between distinct utterances, + * which may have the same textual content. + * UUIDs conveniently fill this purpose. + * + * NOTE: While it is possible to deterministically create UUIDs, we do not do so at this time. + * This should be theoretically possible though if someone cares to write up a proposal and a PR. + */utteranceId: Uuid) { self.text = text self.ssml = ssml self.triggerDistanceBeforeManeuver = triggerDistanceBeforeManeuver @@ -2502,8 +2591,10 @@ public struct SpokenInstruction { } } + + extension SpokenInstruction: Equatable, Hashable { - public static func == (lhs: SpokenInstruction, rhs: SpokenInstruction) -> Bool { + public static func ==(lhs: SpokenInstruction, rhs: SpokenInstruction) -> Bool { if lhs.text != rhs.text { return false } @@ -2527,16 +2618,18 @@ extension SpokenInstruction: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeSpokenInstruction: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SpokenInstruction { - try SpokenInstruction( - text: FfiConverterString.read(from: &buf), - ssml: FfiConverterOptionString.read(from: &buf), - triggerDistanceBeforeManeuver: FfiConverterDouble.read(from: &buf), - utteranceId: FfiConverterTypeUuid.read(from: &buf) + return + try SpokenInstruction( + text: FfiConverterString.read(from: &buf), + ssml: FfiConverterOptionString.read(from: &buf), + triggerDistanceBeforeManeuver: FfiConverterDouble.read(from: &buf), + utteranceId: FfiConverterTypeUuid.read(from: &buf) ) } @@ -2548,20 +2641,22 @@ public struct FfiConverterTypeSpokenInstruction: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeSpokenInstruction_lift(_ buf: RustBuffer) throws -> SpokenInstruction { - try FfiConverterTypeSpokenInstruction.lift(buf) + return try FfiConverterTypeSpokenInstruction.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeSpokenInstruction_lower(_ value: SpokenInstruction) -> RustBuffer { - FfiConverterTypeSpokenInstruction.lower(value) + return FfiConverterTypeSpokenInstruction.lower(value) } + /** * High-level state describing progress through a route. */ @@ -2586,24 +2681,25 @@ public struct TripProgress { public init( /** * The distance to the next maneuver, in meters. - */ distanceToNextManeuver: Double, + */distanceToNextManeuver: Double, /** - * The total distance remaining in the trip, in meters. - * - * This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps. - */ distanceRemaining: Double, + * The total distance remaining in the trip, in meters. + * + * This is the sum of the distance remaining in the current step and the distance remaining in all subsequent steps. + */distanceRemaining: Double, /** - * The total duration remaining in the trip, in seconds. - */ durationRemaining: Double - ) { + * The total duration remaining in the trip, in seconds. + */durationRemaining: Double) { self.distanceToNextManeuver = distanceToNextManeuver self.distanceRemaining = distanceRemaining self.durationRemaining = durationRemaining } } + + extension TripProgress: Equatable, Hashable { - public static func == (lhs: TripProgress, rhs: TripProgress) -> Bool { + public static func ==(lhs: TripProgress, rhs: TripProgress) -> Bool { if lhs.distanceToNextManeuver != rhs.distanceToNextManeuver { return false } @@ -2623,15 +2719,17 @@ extension TripProgress: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeTripProgress: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TripProgress { - try TripProgress( - distanceToNextManeuver: FfiConverterDouble.read(from: &buf), - distanceRemaining: FfiConverterDouble.read(from: &buf), - durationRemaining: FfiConverterDouble.read(from: &buf) + return + try TripProgress( + distanceToNextManeuver: FfiConverterDouble.read(from: &buf), + distanceRemaining: FfiConverterDouble.read(from: &buf), + durationRemaining: FfiConverterDouble.read(from: &buf) ) } @@ -2642,20 +2740,22 @@ public struct FfiConverterTypeTripProgress: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeTripProgress_lift(_ buf: RustBuffer) throws -> TripProgress { - try FfiConverterTypeTripProgress.lift(buf) + return try FfiConverterTypeTripProgress.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeTripProgress_lower(_ value: TripProgress) -> RustBuffer { - FfiConverterTypeTripProgress.lower(value) + return FfiConverterTypeTripProgress.lower(value) } + /** * The location of the user that is navigating. * @@ -2677,11 +2777,10 @@ public struct UserLocation { // Default memberwise initializers are never public by default, so we // declare one manually. - public init(coordinates: GeographicCoordinate, - /** - * The estimated accuracy of the coordinate (in meters) - */ horizontalAccuracy: Double, courseOverGround: CourseOverGround?, timestamp: Date, speed: Speed?) - { + public init(coordinates: GeographicCoordinate, + /** + * The estimated accuracy of the coordinate (in meters) + */horizontalAccuracy: Double, courseOverGround: CourseOverGround?, timestamp: Date, speed: Speed?) { self.coordinates = coordinates self.horizontalAccuracy = horizontalAccuracy self.courseOverGround = courseOverGround @@ -2690,8 +2789,10 @@ public struct UserLocation { } } + + extension UserLocation: Equatable, Hashable { - public static func == (lhs: UserLocation, rhs: UserLocation) -> Bool { + public static func ==(lhs: UserLocation, rhs: UserLocation) -> Bool { if lhs.coordinates != rhs.coordinates { return false } @@ -2719,17 +2820,19 @@ extension UserLocation: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeUserLocation: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> UserLocation { - try UserLocation( - coordinates: FfiConverterTypeGeographicCoordinate.read(from: &buf), - horizontalAccuracy: FfiConverterDouble.read(from: &buf), - courseOverGround: FfiConverterOptionTypeCourseOverGround.read(from: &buf), - timestamp: FfiConverterTimestamp.read(from: &buf), - speed: FfiConverterOptionTypeSpeed.read(from: &buf) + return + try UserLocation( + coordinates: FfiConverterTypeGeographicCoordinate.read(from: &buf), + horizontalAccuracy: FfiConverterDouble.read(from: &buf), + courseOverGround: FfiConverterOptionTypeCourseOverGround.read(from: &buf), + timestamp: FfiConverterTimestamp.read(from: &buf), + speed: FfiConverterOptionTypeSpeed.read(from: &buf) ) } @@ -2742,20 +2845,22 @@ public struct FfiConverterTypeUserLocation: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeUserLocation_lift(_ buf: RustBuffer) throws -> UserLocation { - try FfiConverterTypeUserLocation.lift(buf) + return try FfiConverterTypeUserLocation.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeUserLocation_lower(_ value: UserLocation) -> RustBuffer { - FfiConverterTypeUserLocation.lower(value) + return FfiConverterTypeUserLocation.lower(value) } + /** * An instruction for visual display (usually as banners) at a specific point along a [`RouteStep`]. */ @@ -2786,17 +2891,16 @@ public struct VisualInstruction { * The primary instruction content. * * This is usually given more visual weight. - */ primaryContent: VisualInstructionContent, + */primaryContent: VisualInstructionContent, /** - * Optional secondary instruction content. - */ secondaryContent: VisualInstructionContent?, + * Optional secondary instruction content. + */secondaryContent: VisualInstructionContent?, /** - * Optional sub-maneuver instruction content. - */ subContent: VisualInstructionContent?, + * Optional sub-maneuver instruction content. + */subContent: VisualInstructionContent?, /** - * How far (in meters) from the upcoming maneuver the instruction should start being displayed - */ triggerDistanceBeforeManeuver: Double - ) { + * How far (in meters) from the upcoming maneuver the instruction should start being displayed + */triggerDistanceBeforeManeuver: Double) { self.primaryContent = primaryContent self.secondaryContent = secondaryContent self.subContent = subContent @@ -2804,8 +2908,10 @@ public struct VisualInstruction { } } + + extension VisualInstruction: Equatable, Hashable { - public static func == (lhs: VisualInstruction, rhs: VisualInstruction) -> Bool { + public static func ==(lhs: VisualInstruction, rhs: VisualInstruction) -> Bool { if lhs.primaryContent != rhs.primaryContent { return false } @@ -2829,16 +2935,18 @@ extension VisualInstruction: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeVisualInstruction: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VisualInstruction { - try VisualInstruction( - primaryContent: FfiConverterTypeVisualInstructionContent.read(from: &buf), - secondaryContent: FfiConverterOptionTypeVisualInstructionContent.read(from: &buf), - subContent: FfiConverterOptionTypeVisualInstructionContent.read(from: &buf), - triggerDistanceBeforeManeuver: FfiConverterDouble.read(from: &buf) + return + try VisualInstruction( + primaryContent: FfiConverterTypeVisualInstructionContent.read(from: &buf), + secondaryContent: FfiConverterOptionTypeVisualInstructionContent.read(from: &buf), + subContent: FfiConverterOptionTypeVisualInstructionContent.read(from: &buf), + triggerDistanceBeforeManeuver: FfiConverterDouble.read(from: &buf) ) } @@ -2850,20 +2958,22 @@ public struct FfiConverterTypeVisualInstruction: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeVisualInstruction_lift(_ buf: RustBuffer) throws -> VisualInstruction { - try FfiConverterTypeVisualInstruction.lift(buf) + return try FfiConverterTypeVisualInstruction.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeVisualInstruction_lower(_ value: VisualInstruction) -> RustBuffer { - FfiConverterTypeVisualInstruction.lower(value) + return FfiConverterTypeVisualInstruction.lower(value) } + /** * The content of a visual instruction. */ @@ -2898,24 +3008,23 @@ public struct VisualInstructionContent { public init( /** * The text to display. - */ text: String, + */text: String, /** - * A standardized maneuver type (if any). - */ maneuverType: ManeuverType?, + * A standardized maneuver type (if any). + */maneuverType: ManeuverType?, /** - * A standardized maneuver modifier (if any). - */ maneuverModifier: ManeuverModifier?, + * A standardized maneuver modifier (if any). + */maneuverModifier: ManeuverModifier?, /** - * If applicable, the number of degrees you need to go around the roundabout before exiting. - * - * For example, entering and exiting the roundabout in the same direction of travel - * (as if you had gone straight, apart from the detour) - * would be an exit angle of 180 degrees. - */ roundaboutExitDegrees: UInt16?, + * If applicable, the number of degrees you need to go around the roundabout before exiting. + * + * For example, entering and exiting the roundabout in the same direction of travel + * (as if you had gone straight, apart from the detour) + * would be an exit angle of 180 degrees. + */roundaboutExitDegrees: UInt16?, /** - * Detailed information about the lanes. This is typically only present in sub-maneuver instructions. - */ laneInfo: [LaneInfo]? - ) { + * Detailed information about the lanes. This is typically only present in sub-maneuver instructions. + */laneInfo: [LaneInfo]?) { self.text = text self.maneuverType = maneuverType self.maneuverModifier = maneuverModifier @@ -2924,8 +3033,10 @@ public struct VisualInstructionContent { } } + + extension VisualInstructionContent: Equatable, Hashable { - public static func == (lhs: VisualInstructionContent, rhs: VisualInstructionContent) -> Bool { + public static func ==(lhs: VisualInstructionContent, rhs: VisualInstructionContent) -> Bool { if lhs.text != rhs.text { return false } @@ -2953,17 +3064,19 @@ extension VisualInstructionContent: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeVisualInstructionContent: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> VisualInstructionContent { - try VisualInstructionContent( - text: FfiConverterString.read(from: &buf), - maneuverType: FfiConverterOptionTypeManeuverType.read(from: &buf), - maneuverModifier: FfiConverterOptionTypeManeuverModifier.read(from: &buf), - roundaboutExitDegrees: FfiConverterOptionUInt16.read(from: &buf), - laneInfo: FfiConverterOptionSequenceTypeLaneInfo.read(from: &buf) + return + try VisualInstructionContent( + text: FfiConverterString.read(from: &buf), + maneuverType: FfiConverterOptionTypeManeuverType.read(from: &buf), + maneuverModifier: FfiConverterOptionTypeManeuverModifier.read(from: &buf), + roundaboutExitDegrees: FfiConverterOptionUInt16.read(from: &buf), + laneInfo: FfiConverterOptionSequenceTypeLaneInfo.read(from: &buf) ) } @@ -2976,20 +3089,22 @@ public struct FfiConverterTypeVisualInstructionContent: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeVisualInstructionContent_lift(_ buf: RustBuffer) throws -> VisualInstructionContent { - try FfiConverterTypeVisualInstructionContent.lift(buf) + return try FfiConverterTypeVisualInstructionContent.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeVisualInstructionContent_lower(_ value: VisualInstructionContent) -> RustBuffer { - FfiConverterTypeVisualInstructionContent.lower(value) + return FfiConverterTypeVisualInstructionContent.lower(value) } + /** * A waypoint along a route. * @@ -3015,8 +3130,10 @@ public struct Waypoint { } } + + extension Waypoint: Equatable, Hashable { - public static func == (lhs: Waypoint, rhs: Waypoint) -> Bool { + public static func ==(lhs: Waypoint, rhs: Waypoint) -> Bool { if lhs.coordinate != rhs.coordinate { return false } @@ -3032,14 +3149,16 @@ extension Waypoint: Equatable, Hashable { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeWaypoint: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Waypoint { - try Waypoint( - coordinate: FfiConverterTypeGeographicCoordinate.read(from: &buf), - kind: FfiConverterTypeWaypointKind.read(from: &buf) + return + try Waypoint( + coordinate: FfiConverterTypeGeographicCoordinate.read(from: &buf), + kind: FfiConverterTypeWaypointKind.read(from: &buf) ) } @@ -3049,18 +3168,19 @@ public struct FfiConverterTypeWaypoint: FfiConverterRustBuffer { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeWaypoint_lift(_ buf: RustBuffer) throws -> Waypoint { - try FfiConverterTypeWaypoint.lift(buf) + return try FfiConverterTypeWaypoint.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeWaypoint_lower(_ value: Waypoint) -> RustBuffer { - FfiConverterTypeWaypoint.lower(value) + return FfiConverterTypeWaypoint.lower(value) } // Note that we don't yet support `indirect` for enums. @@ -3070,6 +3190,7 @@ public func FfiConverterTypeWaypoint_lower(_ value: Waypoint) -> RustBuffer { */ public enum CourseFiltering { + /** * Snap the user's course to the current step's linestring using the next index in the step's geometry. @@ -3081,8 +3202,9 @@ public enum CourseFiltering { case raw } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeCourseFiltering: FfiConverterRustBuffer { typealias SwiftType = CourseFiltering @@ -3090,47 +3212,62 @@ public struct FfiConverterTypeCourseFiltering: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CourseFiltering { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .snapToRoute - + case 2: return .raw - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: CourseFiltering, into buf: inout [UInt8]) { switch value { + + case .snapToRoute: writeInt(&buf, Int32(1)) - + + case .raw: writeInt(&buf, Int32(2)) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeCourseFiltering_lift(_ buf: RustBuffer) throws -> CourseFiltering { - try FfiConverterTypeCourseFiltering.lift(buf) + return try FfiConverterTypeCourseFiltering.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeCourseFiltering_lower(_ value: CourseFiltering) -> RustBuffer { - FfiConverterTypeCourseFiltering.lower(value) + return FfiConverterTypeCourseFiltering.lower(value) } + + extension CourseFiltering: Equatable, Hashable {} + + + public enum InstantiationError { + + + case OptionsJsonParseError } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeInstantiationError: FfiConverterRustBuffer { typealias SwiftType = InstantiationError @@ -3138,20 +3275,31 @@ public struct FfiConverterTypeInstantiationError: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> InstantiationError { let variant: Int32 = try readInt(&buf) switch variant { + + + + case 1: return .OptionsJsonParseError - default: throw UniffiInternalError.unexpectedEnumCase + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: InstantiationError, into buf: inout [UInt8]) { switch value { + + + + + case .OptionsJsonParseError: writeInt(&buf, Int32(1)) + } } } + extension InstantiationError: Equatable, Hashable {} extension InstantiationError: Foundation.LocalizedError { @@ -3168,16 +3316,19 @@ extension InstantiationError: Foundation.LocalizedError { */ public enum LocationBias { + /** * Simulates GPS bias by offsetting locations to the left of the route direction. * The f64 parameter specifies the offset distance in meters. */ - case left(Double) + case left(Double + ) /** * Simulates GPS bias by offsetting locations to the right of the route direction. * The f64 parameter specifies the offset distance in meters. */ - case right(Double) + case right(Double + ) /** * Simulates GPS bias by randomly choosing left or right offset on initialization * and maintaining that bias throughout the route. @@ -3186,7 +3337,8 @@ public enum LocationBias { * This mimics real-world GPS behavior where bias direction is random but typically * remains consistent during a trip. */ - case random(Double) + case random(Double + ) /** * No position bias - locations follow the route line exactly. * @@ -3196,8 +3348,9 @@ public enum LocationBias { case none } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeLocationBias: FfiConverterRustBuffer { typealias SwiftType = LocationBias @@ -3205,54 +3358,69 @@ public struct FfiConverterTypeLocationBias: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> LocationBias { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .left(FfiConverterDouble.read(from: &buf)) - - case 2: return try .right(FfiConverterDouble.read(from: &buf)) - - case 3: return try .random(FfiConverterDouble.read(from: &buf)) - + + case 1: return .left(try FfiConverterDouble.read(from: &buf) + ) + + case 2: return .right(try FfiConverterDouble.read(from: &buf) + ) + + case 3: return .random(try FfiConverterDouble.read(from: &buf) + ) + case 4: return .none - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: LocationBias, into buf: inout [UInt8]) { switch value { + + case let .left(v1): writeInt(&buf, Int32(1)) FfiConverterDouble.write(v1, into: &buf) - + + case let .right(v1): writeInt(&buf, Int32(2)) FfiConverterDouble.write(v1, into: &buf) - + + case let .random(v1): writeInt(&buf, Int32(3)) FfiConverterDouble.write(v1, into: &buf) - + + case .none: writeInt(&buf, Int32(4)) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeLocationBias_lift(_ buf: RustBuffer) throws -> LocationBias { - try FfiConverterTypeLocationBias.lift(buf) + return try FfiConverterTypeLocationBias.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeLocationBias_lower(_ value: LocationBias) -> RustBuffer { - FfiConverterTypeLocationBias.lower(value) + return FfiConverterTypeLocationBias.lower(value) } + + extension LocationBias: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. /** @@ -3260,6 +3428,7 @@ extension LocationBias: Equatable, Hashable {} */ public enum ManeuverModifier { + case uTurn case sharpRight case right @@ -3270,8 +3439,9 @@ public enum ManeuverModifier { case sharpLeft } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeManeuverModifier: FfiConverterRustBuffer { typealias SwiftType = ManeuverModifier @@ -3279,71 +3449,87 @@ public struct FfiConverterTypeManeuverModifier: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ManeuverModifier { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .uTurn - + case 2: return .sharpRight - + case 3: return .right - + case 4: return .slightRight - + case 5: return .straight - + case 6: return .slightLeft - + case 7: return .left - + case 8: return .sharpLeft - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ManeuverModifier, into buf: inout [UInt8]) { switch value { + + case .uTurn: writeInt(&buf, Int32(1)) - + + case .sharpRight: writeInt(&buf, Int32(2)) - + + case .right: writeInt(&buf, Int32(3)) - + + case .slightRight: writeInt(&buf, Int32(4)) - + + case .straight: writeInt(&buf, Int32(5)) - + + case .slightLeft: writeInt(&buf, Int32(6)) - + + case .left: writeInt(&buf, Int32(7)) - + + case .sharpLeft: writeInt(&buf, Int32(8)) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeManeuverModifier_lift(_ buf: RustBuffer) throws -> ManeuverModifier { - try FfiConverterTypeManeuverModifier.lift(buf) + return try FfiConverterTypeManeuverModifier.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeManeuverModifier_lower(_ value: ManeuverModifier) -> RustBuffer { - FfiConverterTypeManeuverModifier.lower(value) + return FfiConverterTypeManeuverModifier.lower(value) } + + extension ManeuverModifier: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. /** @@ -3353,6 +3539,7 @@ extension ManeuverModifier: Equatable, Hashable {} */ public enum ManeuverType { + case turn case newName case depart @@ -3371,8 +3558,9 @@ public enum ManeuverType { case exitRotary } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeManeuverType: FfiConverterRustBuffer { typealias SwiftType = ManeuverType @@ -3380,117 +3568,147 @@ public struct FfiConverterTypeManeuverType: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ManeuverType { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .turn - + case 2: return .newName - + case 3: return .depart - + case 4: return .arrive - + case 5: return .merge - + case 6: return .onRamp - + case 7: return .offRamp - + case 8: return .fork - + case 9: return .endOfRoad - - case 10: return .continue - + + case 10: return .`continue` + case 11: return .roundabout - + case 12: return .rotary - + case 13: return .roundaboutTurn - + case 14: return .notification - + case 15: return .exitRoundabout - + case 16: return .exitRotary - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ManeuverType, into buf: inout [UInt8]) { switch value { + + case .turn: writeInt(&buf, Int32(1)) - + + case .newName: writeInt(&buf, Int32(2)) - + + case .depart: writeInt(&buf, Int32(3)) - + + case .arrive: writeInt(&buf, Int32(4)) - + + case .merge: writeInt(&buf, Int32(5)) - + + case .onRamp: writeInt(&buf, Int32(6)) - + + case .offRamp: writeInt(&buf, Int32(7)) - + + case .fork: writeInt(&buf, Int32(8)) - + + case .endOfRoad: writeInt(&buf, Int32(9)) - - case .continue: + + + case .`continue`: writeInt(&buf, Int32(10)) - + + case .roundabout: writeInt(&buf, Int32(11)) - + + case .rotary: writeInt(&buf, Int32(12)) - + + case .roundaboutTurn: writeInt(&buf, Int32(13)) - + + case .notification: writeInt(&buf, Int32(14)) - + + case .exitRoundabout: writeInt(&buf, Int32(15)) - + + case .exitRotary: writeInt(&buf, Int32(16)) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeManeuverType_lift(_ buf: RustBuffer) throws -> ManeuverType { - try FfiConverterTypeManeuverType.lift(buf) + return try FfiConverterTypeManeuverType.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeManeuverType_lower(_ value: ManeuverType) -> RustBuffer { - FfiConverterTypeManeuverType.lower(value) + return FfiConverterTypeManeuverType.lower(value) } + + extension ManeuverType: Equatable, Hashable {} + + + public enum ModelError { - case PolylineGenerationError(error: String) + + + + case PolylineGenerationError(error: String + ) } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeModelError: FfiConverterRustBuffer { typealias SwiftType = ModelError @@ -3498,23 +3716,34 @@ public struct FfiConverterTypeModelError: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ModelError { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .PolylineGenerationError( - error: FfiConverterString.read(from: &buf) + + + + + case 1: return .PolylineGenerationError( + error: try FfiConverterString.read(from: &buf) ) - default: throw UniffiInternalError.unexpectedEnumCase + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ModelError, into buf: inout [UInt8]) { switch value { + + + + + case let .PolylineGenerationError(error): writeInt(&buf, Int32(1)) FfiConverterString.write(error, into: &buf) + } } } + extension ModelError: Equatable, Hashable {} extension ModelError: Foundation.LocalizedError { @@ -3523,16 +3752,25 @@ extension ModelError: Foundation.LocalizedError { } } + public enum ParsingError { - case InvalidRouteObject(error: String) - case InvalidGeometry(error: String) - case MalformedAnnotations(error: String) - case InvalidStatusCode(code: String) + + + + case InvalidRouteObject(error: String + ) + case InvalidGeometry(error: String + ) + case MalformedAnnotations(error: String + ) + case InvalidStatusCode(code: String + ) case UnknownParsingError } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeParsingError: FfiConverterRustBuffer { typealias SwiftType = ParsingError @@ -3540,47 +3778,63 @@ public struct FfiConverterTypeParsingError: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ParsingError { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .InvalidRouteObject( - error: FfiConverterString.read(from: &buf) + + + + + case 1: return .InvalidRouteObject( + error: try FfiConverterString.read(from: &buf) ) - case 2: return try .InvalidGeometry( - error: FfiConverterString.read(from: &buf) + case 2: return .InvalidGeometry( + error: try FfiConverterString.read(from: &buf) ) - case 3: return try .MalformedAnnotations( - error: FfiConverterString.read(from: &buf) + case 3: return .MalformedAnnotations( + error: try FfiConverterString.read(from: &buf) ) - case 4: return try .InvalidStatusCode( - code: FfiConverterString.read(from: &buf) + case 4: return .InvalidStatusCode( + code: try FfiConverterString.read(from: &buf) ) case 5: return .UnknownParsingError - default: throw UniffiInternalError.unexpectedEnumCase + + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: ParsingError, into buf: inout [UInt8]) { switch value { + + + + + case let .InvalidRouteObject(error): writeInt(&buf, Int32(1)) FfiConverterString.write(error, into: &buf) - + + case let .InvalidGeometry(error): writeInt(&buf, Int32(2)) FfiConverterString.write(error, into: &buf) - + + case let .MalformedAnnotations(error): writeInt(&buf, Int32(3)) FfiConverterString.write(error, into: &buf) - + + case let .InvalidStatusCode(code): writeInt(&buf, Int32(4)) FfiConverterString.write(code, into: &buf) - + + case .UnknownParsingError: writeInt(&buf, Int32(5)) + } } } + extension ParsingError: Equatable, Hashable {} extension ParsingError: Foundation.LocalizedError { @@ -3599,6 +3853,7 @@ extension ParsingError: Foundation.LocalizedError { */ public enum RouteDeviation { + /** * The user is proceeding on course within the expected tolerances; everything is normal. */ @@ -3609,12 +3864,13 @@ public enum RouteDeviation { case offRoute( /** * The deviation from the route line, in meters. - */ deviationFromRouteLine: Double + */deviationFromRouteLine: Double ) } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRouteDeviation: FfiConverterRustBuffer { typealias SwiftType = RouteDeviation @@ -3622,42 +3878,53 @@ public struct FfiConverterTypeRouteDeviation: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteDeviation { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .noDeviation - - case 2: return try .offRoute(deviationFromRouteLine: FfiConverterDouble.read(from: &buf)) - + + case 2: return .offRoute(deviationFromRouteLine: try FfiConverterDouble.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: RouteDeviation, into buf: inout [UInt8]) { switch value { + + case .noDeviation: writeInt(&buf, Int32(1)) - + + case let .offRoute(deviationFromRouteLine): writeInt(&buf, Int32(2)) FfiConverterDouble.write(deviationFromRouteLine, into: &buf) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteDeviation_lift(_ buf: RustBuffer) throws -> RouteDeviation { - try FfiConverterTypeRouteDeviation.lift(buf) + return try FfiConverterTypeRouteDeviation.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteDeviation_lower(_ value: RouteDeviation) -> RustBuffer { - FfiConverterTypeRouteDeviation.lower(value) + return FfiConverterTypeRouteDeviation.lower(value) } + + extension RouteDeviation: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. /** @@ -3665,6 +3932,7 @@ extension RouteDeviation: Equatable, Hashable {} */ public enum RouteDeviationTracking { + /** * No checks will be done, and we assume the user is always following the route. */ @@ -3676,23 +3944,25 @@ public enum RouteDeviationTracking { /** * The minimum required horizontal accuracy of the user location, in meters. * Values larger than this will not trigger route deviation warnings. - */ minimumHorizontalAccuracy: UInt16, + */minimumHorizontalAccuracy: UInt16, /** - * The maximum acceptable deviation from the route line, in meters. - * - * If the distance between the reported location and the expected route line - * is greater than this threshold, it will be flagged as an off route condition. - */ maxAcceptableDeviation: Double + * The maximum acceptable deviation from the route line, in meters. + * + * If the distance between the reported location and the expected route line + * is greater than this threshold, it will be flagged as an off route condition. + */maxAcceptableDeviation: Double ) /** * An arbitrary user-defined implementation. * You decide with your own [`RouteDeviationDetector`] implementation! */ - case custom(detector: RouteDeviationDetector) + case custom(detector: RouteDeviationDetector + ) } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRouteDeviationTracking: FfiConverterRustBuffer { typealias SwiftType = RouteDeviationTracking @@ -3700,50 +3970,59 @@ public struct FfiConverterTypeRouteDeviationTracking: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteDeviationTracking { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .none - - case 2: return try .staticThreshold( - minimumHorizontalAccuracy: FfiConverterUInt16.read(from: &buf), - maxAcceptableDeviation: FfiConverterDouble.read(from: &buf) - ) - - case 3: return try .custom(detector: FfiConverterTypeRouteDeviationDetector.read(from: &buf)) - + + case 2: return .staticThreshold(minimumHorizontalAccuracy: try FfiConverterUInt16.read(from: &buf), maxAcceptableDeviation: try FfiConverterDouble.read(from: &buf) + ) + + case 3: return .custom(detector: try FfiConverterTypeRouteDeviationDetector.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: RouteDeviationTracking, into buf: inout [UInt8]) { switch value { + + case .none: writeInt(&buf, Int32(1)) - - case let .staticThreshold(minimumHorizontalAccuracy, maxAcceptableDeviation): + + + case let .staticThreshold(minimumHorizontalAccuracy,maxAcceptableDeviation): writeInt(&buf, Int32(2)) FfiConverterUInt16.write(minimumHorizontalAccuracy, into: &buf) FfiConverterDouble.write(maxAcceptableDeviation, into: &buf) - + + case let .custom(detector): writeInt(&buf, Int32(3)) FfiConverterTypeRouteDeviationDetector.write(detector, into: &buf) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteDeviationTracking_lift(_ buf: RustBuffer) throws -> RouteDeviationTracking { - try FfiConverterTypeRouteDeviationTracking.lift(buf) + return try FfiConverterTypeRouteDeviationTracking.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteDeviationTracking_lower(_ value: RouteDeviationTracking) -> RustBuffer { - FfiConverterTypeRouteDeviationTracking.lower(value) + return FfiConverterTypeRouteDeviationTracking.lower(value) } + + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. /** @@ -3751,12 +4030,16 @@ public func FfiConverterTypeRouteDeviationTracking_lower(_ value: RouteDeviation */ public enum RouteRequest { - case httpPost(url: String, headers: [String: String], body: Data) - case httpGet(url: String, headers: [String: String]) + + case httpPost(url: String, headers: [String: String], body: Data + ) + case httpGet(url: String, headers: [String: String] + ) } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRouteRequest: FfiConverterRustBuffer { typealias SwiftType = RouteRequest @@ -3764,61 +4047,71 @@ public struct FfiConverterTypeRouteRequest: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RouteRequest { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .httpPost( - url: FfiConverterString.read(from: &buf), - headers: FfiConverterDictionaryStringString.read(from: &buf), - body: FfiConverterData.read(from: &buf) - ) - - case 2: return try .httpGet( - url: FfiConverterString.read(from: &buf), - headers: FfiConverterDictionaryStringString.read(from: &buf) - ) - + + case 1: return .httpPost(url: try FfiConverterString.read(from: &buf), headers: try FfiConverterDictionaryStringString.read(from: &buf), body: try FfiConverterData.read(from: &buf) + ) + + case 2: return .httpGet(url: try FfiConverterString.read(from: &buf), headers: try FfiConverterDictionaryStringString.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: RouteRequest, into buf: inout [UInt8]) { switch value { - case let .httpPost(url, headers, body): + + + case let .httpPost(url,headers,body): writeInt(&buf, Int32(1)) FfiConverterString.write(url, into: &buf) FfiConverterDictionaryStringString.write(headers, into: &buf) FfiConverterData.write(body, into: &buf) - - case let .httpGet(url, headers): + + + case let .httpGet(url,headers): writeInt(&buf, Int32(2)) FfiConverterString.write(url, into: &buf) FfiConverterDictionaryStringString.write(headers, into: &buf) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteRequest_lift(_ buf: RustBuffer) throws -> RouteRequest { - try FfiConverterTypeRouteRequest.lift(buf) + return try FfiConverterTypeRouteRequest.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeRouteRequest_lower(_ value: RouteRequest) -> RustBuffer { - FfiConverterTypeRouteRequest.lower(value) + return FfiConverterTypeRouteRequest.lower(value) } + + extension RouteRequest: Equatable, Hashable {} + + + public enum RoutingRequestGenerationError { + + + case NotEnoughWaypoints case JsonError case UnknownRequestGenerationError } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeRoutingRequestGenerationError: FfiConverterRustBuffer { typealias SwiftType = RoutingRequestGenerationError @@ -3826,27 +4119,41 @@ public struct FfiConverterTypeRoutingRequestGenerationError: FfiConverterRustBuf public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RoutingRequestGenerationError { let variant: Int32 = try readInt(&buf) switch variant { + + + + case 1: return .NotEnoughWaypoints case 2: return .JsonError case 3: return .UnknownRequestGenerationError - default: throw UniffiInternalError.unexpectedEnumCase + + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: RoutingRequestGenerationError, into buf: inout [UInt8]) { switch value { + + + + + case .NotEnoughWaypoints: writeInt(&buf, Int32(1)) - + + case .JsonError: writeInt(&buf, Int32(2)) - + + case .UnknownRequestGenerationError: writeInt(&buf, Int32(3)) + } } } + extension RoutingRequestGenerationError: Equatable, Hashable {} extension RoutingRequestGenerationError: Foundation.LocalizedError { @@ -3855,19 +4162,25 @@ extension RoutingRequestGenerationError: Foundation.LocalizedError { } } + public enum SimulationError { + + + /** * Errors decoding the polyline string. */ - case PolylineError(error: String) + case PolylineError(error: String + ) /** * Not enough points in the input. */ case NotEnoughPoints } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeSimulationError: FfiConverterRustBuffer { typealias SwiftType = SimulationError @@ -3875,28 +4188,39 @@ public struct FfiConverterTypeSimulationError: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SimulationError { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return try .PolylineError( - error: FfiConverterString.read(from: &buf) - ) + + + + case 1: return .PolylineError( + error: try FfiConverterString.read(from: &buf) + ) case 2: return .NotEnoughPoints - default: throw UniffiInternalError.unexpectedEnumCase + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: SimulationError, into buf: inout [UInt8]) { switch value { + + + + + case let .PolylineError(error): writeInt(&buf, Int32(1)) FfiConverterString.write(error, into: &buf) - + + case .NotEnoughPoints: writeInt(&buf, Int32(2)) + } } } + extension SimulationError: Equatable, Hashable {} extension SimulationError: Foundation.LocalizedError { @@ -3913,6 +4237,7 @@ extension SimulationError: Foundation.LocalizedError { */ public enum StepAdvanceMode { + /** * Never advances to the next step automatically; * requires calling [`NavigationController::advance_to_next_step`](super::NavigationController::advance_to_next_step). @@ -3926,11 +4251,11 @@ public enum StepAdvanceMode { case distanceToEndOfStep( /** * Distance to the last waypoint in the step, measured in meters, at which to advance. - */ distance: UInt16, + */distance: UInt16, /** - * The minimum required horizontal accuracy of the user location, in meters. - * Values larger than this cannot trigger a step advance. - */ minimumHorizontalAccuracy: UInt16 + * The minimum required horizontal accuracy of the user location, in meters. + * Values larger than this cannot trigger a step advance. + */minimumHorizontalAccuracy: UInt16 ) /** * Automatically advances when the user's distance to the *next* step's linestring is less @@ -3940,16 +4265,17 @@ public enum StepAdvanceMode { /** * The minimum required horizontal accuracy of the user location, in meters. * Values larger than this cannot trigger a step advance. - */ minimumHorizontalAccuracy: UInt16, + */minimumHorizontalAccuracy: UInt16, /** - * At this (optional) distance, navigation should advance to the next step regardless - * of which `LineString` appears closer. - */ automaticAdvanceDistance: UInt16? + * At this (optional) distance, navigation should advance to the next step regardless + * of which `LineString` appears closer. + */automaticAdvanceDistance: UInt16? ) } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeStepAdvanceMode: FfiConverterRustBuffer { typealias SwiftType = StepAdvanceMode @@ -3957,56 +4283,63 @@ public struct FfiConverterTypeStepAdvanceMode: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> StepAdvanceMode { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .manual - - case 2: return try .distanceToEndOfStep( - distance: FfiConverterUInt16.read(from: &buf), - minimumHorizontalAccuracy: FfiConverterUInt16.read(from: &buf) - ) - - case 3: return try .relativeLineStringDistance( - minimumHorizontalAccuracy: FfiConverterUInt16.read(from: &buf), - automaticAdvanceDistance: FfiConverterOptionUInt16.read(from: &buf) - ) - + + case 2: return .distanceToEndOfStep(distance: try FfiConverterUInt16.read(from: &buf), minimumHorizontalAccuracy: try FfiConverterUInt16.read(from: &buf) + ) + + case 3: return .relativeLineStringDistance(minimumHorizontalAccuracy: try FfiConverterUInt16.read(from: &buf), automaticAdvanceDistance: try FfiConverterOptionUInt16.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: StepAdvanceMode, into buf: inout [UInt8]) { switch value { + + case .manual: writeInt(&buf, Int32(1)) - - case let .distanceToEndOfStep(distance, minimumHorizontalAccuracy): + + + case let .distanceToEndOfStep(distance,minimumHorizontalAccuracy): writeInt(&buf, Int32(2)) FfiConverterUInt16.write(distance, into: &buf) FfiConverterUInt16.write(minimumHorizontalAccuracy, into: &buf) - - case let .relativeLineStringDistance(minimumHorizontalAccuracy, automaticAdvanceDistance): + + + case let .relativeLineStringDistance(minimumHorizontalAccuracy,automaticAdvanceDistance): writeInt(&buf, Int32(3)) FfiConverterUInt16.write(minimumHorizontalAccuracy, into: &buf) FfiConverterOptionUInt16.write(automaticAdvanceDistance, into: &buf) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeStepAdvanceMode_lift(_ buf: RustBuffer) throws -> StepAdvanceMode { - try FfiConverterTypeStepAdvanceMode.lift(buf) + return try FfiConverterTypeStepAdvanceMode.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeStepAdvanceMode_lower(_ value: StepAdvanceMode) -> RustBuffer { - FfiConverterTypeStepAdvanceMode.lower(value) + return FfiConverterTypeStepAdvanceMode.lower(value) } + + extension StepAdvanceMode: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. /** @@ -4018,6 +4351,7 @@ extension StepAdvanceMode: Equatable, Hashable {} */ public enum TripState { + /** * The navigation controller is idle and there is no active trip. */ @@ -4030,45 +4364,45 @@ public enum TripState { * The index of the closest coordinate to the user's snapped location. * * This index is relative to the *current* [`RouteStep`]'s geometry. - */ currentStepGeometryIndex: UInt64?, + */currentStepGeometryIndex: UInt64?, /** - * A location on the line string that - */ snappedUserLocation: UserLocation, + * A location on the line string that + */snappedUserLocation: UserLocation, /** - * The ordered list of steps that remain in the trip. - * - * The step at the front of the list is always the current step. - * We currently assume that you cannot move backward to a previous step. - */ remainingSteps: [RouteStep], + * The ordered list of steps that remain in the trip. + * + * The step at the front of the list is always the current step. + * We currently assume that you cannot move backward to a previous step. + */remainingSteps: [RouteStep], /** - * Remaining waypoints to visit on the route. - * - * The waypoint at the front of the list is always the *next* waypoint "goal." - * Unlike the current step, there is no value in tracking the "current" waypoint, - * as the main use of waypoints is recalculation when the user deviates from the route. - * (In most use cases, a route will have only two waypoints, but more complex use cases - * may have multiple intervening points that are visited along the route.) - * This list is updated as the user advances through the route. - */ remainingWaypoints: [Waypoint], + * Remaining waypoints to visit on the route. + * + * The waypoint at the front of the list is always the *next* waypoint "goal." + * Unlike the current step, there is no value in tracking the "current" waypoint, + * as the main use of waypoints is recalculation when the user deviates from the route. + * (In most use cases, a route will have only two waypoints, but more complex use cases + * may have multiple intervening points that are visited along the route.) + * This list is updated as the user advances through the route. + */remainingWaypoints: [Waypoint], /** - * The trip progress includes information that is useful for showing the - * user's progress along the full navigation trip, the route and its components. - */ progress: TripProgress, + * The trip progress includes information that is useful for showing the + * user's progress along the full navigation trip, the route and its components. + */progress: TripProgress, /** - * The route deviation status: is the user following the route or not? - */ deviation: RouteDeviation, + * The route deviation status: is the user following the route or not? + */deviation: RouteDeviation, /** - * The visual instruction that should be displayed in the user interface. - */ visualInstruction: VisualInstruction?, + * The visual instruction that should be displayed in the user interface. + */visualInstruction: VisualInstruction?, /** - * The most recent spoken instruction that should be synthesized using TTS. - * - * Note it is the responsibility of the platform layer to ensure that utterances are not synthesized multiple times. This property simply reports the current spoken instruction. - */ spokenInstruction: SpokenInstruction?, + * The most recent spoken instruction that should be synthesized using TTS. + * + * Note it is the responsibility of the platform layer to ensure that utterances are not synthesized multiple times. This property simply reports the current spoken instruction. + */spokenInstruction: SpokenInstruction?, /** - * Annotation data at the current location. - * This is represented as a json formatted byte array to allow for flexible encoding of custom annotations. - */ annotationJson: String? + * Annotation data at the current location. + * This is represented as a json formatted byte array to allow for flexible encoding of custom annotations. + */annotationJson: String? ) /** * The navigation controller has reached the end of the trip. @@ -4076,8 +4410,9 @@ public enum TripState { case complete } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeTripState: FfiConverterRustBuffer { typealias SwiftType = TripState @@ -4085,42 +4420,27 @@ public struct FfiConverterTypeTripState: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> TripState { let variant: Int32 = try readInt(&buf) switch variant { + case 1: return .idle - - case 2: return try .navigating( - currentStepGeometryIndex: FfiConverterOptionUInt64.read(from: &buf), - snappedUserLocation: FfiConverterTypeUserLocation.read(from: &buf), - remainingSteps: FfiConverterSequenceTypeRouteStep.read(from: &buf), - remainingWaypoints: FfiConverterSequenceTypeWaypoint.read(from: &buf), - progress: FfiConverterTypeTripProgress.read(from: &buf), - deviation: FfiConverterTypeRouteDeviation.read(from: &buf), - visualInstruction: FfiConverterOptionTypeVisualInstruction.read(from: &buf), - spokenInstruction: FfiConverterOptionTypeSpokenInstruction.read(from: &buf), - annotationJson: FfiConverterOptionString.read(from: &buf) - ) - + + case 2: return .navigating(currentStepGeometryIndex: try FfiConverterOptionUInt64.read(from: &buf), snappedUserLocation: try FfiConverterTypeUserLocation.read(from: &buf), remainingSteps: try FfiConverterSequenceTypeRouteStep.read(from: &buf), remainingWaypoints: try FfiConverterSequenceTypeWaypoint.read(from: &buf), progress: try FfiConverterTypeTripProgress.read(from: &buf), deviation: try FfiConverterTypeRouteDeviation.read(from: &buf), visualInstruction: try FfiConverterOptionTypeVisualInstruction.read(from: &buf), spokenInstruction: try FfiConverterOptionTypeSpokenInstruction.read(from: &buf), annotationJson: try FfiConverterOptionString.read(from: &buf) + ) + case 3: return .complete - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: TripState, into buf: inout [UInt8]) { switch value { + + case .idle: writeInt(&buf, Int32(1)) - - case let .navigating( - currentStepGeometryIndex, - snappedUserLocation, - remainingSteps, - remainingWaypoints, - progress, - deviation, - visualInstruction, - spokenInstruction, - annotationJson - ): + + + case let .navigating(currentStepGeometryIndex,snappedUserLocation,remainingSteps,remainingWaypoints,progress,deviation,visualInstruction,spokenInstruction,annotationJson): writeInt(&buf, Int32(2)) FfiConverterOptionUInt64.write(currentStepGeometryIndex, into: &buf) FfiConverterTypeUserLocation.write(snappedUserLocation, into: &buf) @@ -4131,29 +4451,36 @@ public struct FfiConverterTypeTripState: FfiConverterRustBuffer { FfiConverterOptionTypeVisualInstruction.write(visualInstruction, into: &buf) FfiConverterOptionTypeSpokenInstruction.write(spokenInstruction, into: &buf) FfiConverterOptionString.write(annotationJson, into: &buf) - + + case .complete: writeInt(&buf, Int32(3)) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeTripState_lift(_ buf: RustBuffer) throws -> TripState { - try FfiConverterTypeTripState.lift(buf) + return try FfiConverterTypeTripState.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeTripState_lower(_ value: TripState) -> RustBuffer { - FfiConverterTypeTripState.lower(value) + return FfiConverterTypeTripState.lower(value) } + + extension TripState: Equatable, Hashable {} + + // Note that we don't yet support `indirect` for enums. // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion. /** @@ -4161,6 +4488,7 @@ extension TripState: Equatable, Hashable {} */ public enum WaypointKind { + /** * Starts or ends a leg of the trip. * @@ -4173,8 +4501,9 @@ public enum WaypointKind { case via } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeWaypointKind: FfiConverterRustBuffer { typealias SwiftType = WaypointKind @@ -4182,49 +4511,59 @@ public struct FfiConverterTypeWaypointKind: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WaypointKind { let variant: Int32 = try readInt(&buf) switch variant { - case 1: return .break - + + case 1: return .`break` + case 2: return .via - + default: throw UniffiInternalError.unexpectedEnumCase } } public static func write(_ value: WaypointKind, into buf: inout [UInt8]) { switch value { - case .break: + + + case .`break`: writeInt(&buf, Int32(1)) - + + case .via: writeInt(&buf, Int32(2)) + } } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeWaypointKind_lift(_ buf: RustBuffer) throws -> WaypointKind { - try FfiConverterTypeWaypointKind.lift(buf) + return try FfiConverterTypeWaypointKind.lift(buf) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeWaypointKind_lower(_ value: WaypointKind) -> RustBuffer { - FfiConverterTypeWaypointKind.lower(value) + return FfiConverterTypeWaypointKind.lower(value) } + + extension WaypointKind: Equatable, Hashable {} + + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionUInt16: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionUInt16: FfiConverterRustBuffer { typealias SwiftType = UInt16? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4242,13 +4581,13 @@ private struct FfiConverterOptionUInt16: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionUInt64: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionUInt64: FfiConverterRustBuffer { typealias SwiftType = UInt64? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4266,13 +4605,13 @@ private struct FfiConverterOptionUInt64: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionDouble: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionDouble: FfiConverterRustBuffer { typealias SwiftType = Double? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4290,13 +4629,13 @@ private struct FfiConverterOptionDouble: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionString: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionString: FfiConverterRustBuffer { typealias SwiftType = String? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4314,13 +4653,13 @@ private struct FfiConverterOptionString: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionTypeCourseOverGround: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeCourseOverGround: FfiConverterRustBuffer { typealias SwiftType = CourseOverGround? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4338,13 +4677,13 @@ private struct FfiConverterOptionTypeCourseOverGround: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionTypeSpeed: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeSpeed: FfiConverterRustBuffer { typealias SwiftType = Speed? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4362,13 +4701,13 @@ private struct FfiConverterOptionTypeSpeed: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionTypeSpokenInstruction: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeSpokenInstruction: FfiConverterRustBuffer { typealias SwiftType = SpokenInstruction? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4386,13 +4725,13 @@ private struct FfiConverterOptionTypeSpokenInstruction: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionTypeVisualInstruction: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeVisualInstruction: FfiConverterRustBuffer { typealias SwiftType = VisualInstruction? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4410,13 +4749,13 @@ private struct FfiConverterOptionTypeVisualInstruction: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionTypeVisualInstructionContent: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeVisualInstructionContent: FfiConverterRustBuffer { typealias SwiftType = VisualInstructionContent? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4434,13 +4773,13 @@ private struct FfiConverterOptionTypeVisualInstructionContent: FfiConverterRustB } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionTypeManeuverModifier: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeManeuverModifier: FfiConverterRustBuffer { typealias SwiftType = ManeuverModifier? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4458,13 +4797,13 @@ private struct FfiConverterOptionTypeManeuverModifier: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionTypeManeuverType: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionTypeManeuverType: FfiConverterRustBuffer { typealias SwiftType = ManeuverType? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4482,13 +4821,13 @@ private struct FfiConverterOptionTypeManeuverType: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionSequenceString: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionSequenceString: FfiConverterRustBuffer { typealias SwiftType = [String]? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4506,13 +4845,13 @@ private struct FfiConverterOptionSequenceString: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterOptionSequenceTypeLaneInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterOptionSequenceTypeLaneInfo: FfiConverterRustBuffer { typealias SwiftType = [LaneInfo]? public static func write(_ value: SwiftType, into buf: inout [UInt8]) { - guard let value else { + guard let value = value else { writeInt(&buf, Int8(0)) return } @@ -4530,9 +4869,9 @@ private struct FfiConverterOptionSequenceTypeLaneInfo: FfiConverterRustBuffer { } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterSequenceString: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer { typealias SwiftType = [String] public static func write(_ value: [String], into buf: inout [UInt8]) { @@ -4548,16 +4887,16 @@ private struct FfiConverterSequenceString: FfiConverterRustBuffer { var seq = [String]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterString.read(from: &buf)) + seq.append(try FfiConverterString.read(from: &buf)) } return seq } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterSequenceTypeGeographicCoordinate: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeGeographicCoordinate: FfiConverterRustBuffer { typealias SwiftType = [GeographicCoordinate] public static func write(_ value: [GeographicCoordinate], into buf: inout [UInt8]) { @@ -4573,16 +4912,16 @@ private struct FfiConverterSequenceTypeGeographicCoordinate: FfiConverterRustBuf var seq = [GeographicCoordinate]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeGeographicCoordinate.read(from: &buf)) + seq.append(try FfiConverterTypeGeographicCoordinate.read(from: &buf)) } return seq } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterSequenceTypeLaneInfo: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeLaneInfo: FfiConverterRustBuffer { typealias SwiftType = [LaneInfo] public static func write(_ value: [LaneInfo], into buf: inout [UInt8]) { @@ -4598,16 +4937,16 @@ private struct FfiConverterSequenceTypeLaneInfo: FfiConverterRustBuffer { var seq = [LaneInfo]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeLaneInfo.read(from: &buf)) + seq.append(try FfiConverterTypeLaneInfo.read(from: &buf)) } return seq } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterSequenceTypeRoute: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeRoute: FfiConverterRustBuffer { typealias SwiftType = [Route] public static func write(_ value: [Route], into buf: inout [UInt8]) { @@ -4623,16 +4962,16 @@ private struct FfiConverterSequenceTypeRoute: FfiConverterRustBuffer { var seq = [Route]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeRoute.read(from: &buf)) + seq.append(try FfiConverterTypeRoute.read(from: &buf)) } return seq } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterSequenceTypeRouteStep: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeRouteStep: FfiConverterRustBuffer { typealias SwiftType = [RouteStep] public static func write(_ value: [RouteStep], into buf: inout [UInt8]) { @@ -4648,16 +4987,16 @@ private struct FfiConverterSequenceTypeRouteStep: FfiConverterRustBuffer { var seq = [RouteStep]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeRouteStep.read(from: &buf)) + seq.append(try FfiConverterTypeRouteStep.read(from: &buf)) } return seq } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterSequenceTypeSpokenInstruction: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeSpokenInstruction: FfiConverterRustBuffer { typealias SwiftType = [SpokenInstruction] public static func write(_ value: [SpokenInstruction], into buf: inout [UInt8]) { @@ -4673,16 +5012,16 @@ private struct FfiConverterSequenceTypeSpokenInstruction: FfiConverterRustBuffer var seq = [SpokenInstruction]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeSpokenInstruction.read(from: &buf)) + seq.append(try FfiConverterTypeSpokenInstruction.read(from: &buf)) } return seq } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterSequenceTypeVisualInstruction: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeVisualInstruction: FfiConverterRustBuffer { typealias SwiftType = [VisualInstruction] public static func write(_ value: [VisualInstruction], into buf: inout [UInt8]) { @@ -4698,16 +5037,16 @@ private struct FfiConverterSequenceTypeVisualInstruction: FfiConverterRustBuffer var seq = [VisualInstruction]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeVisualInstruction.read(from: &buf)) + seq.append(try FfiConverterTypeVisualInstruction.read(from: &buf)) } return seq } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterSequenceTypeWaypoint: FfiConverterRustBuffer { +fileprivate struct FfiConverterSequenceTypeWaypoint: FfiConverterRustBuffer { typealias SwiftType = [Waypoint] public static func write(_ value: [Waypoint], into buf: inout [UInt8]) { @@ -4723,16 +5062,16 @@ private struct FfiConverterSequenceTypeWaypoint: FfiConverterRustBuffer { var seq = [Waypoint]() seq.reserveCapacity(Int(len)) for _ in 0 ..< len { - try seq.append(FfiConverterTypeWaypoint.read(from: &buf)) + seq.append(try FfiConverterTypeWaypoint.read(from: &buf)) } return seq } } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif -private struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { +fileprivate struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { public static func write(_ value: [String: String], into buf: inout [UInt8]) { let len = Int32(value.count) writeInt(&buf, len) @@ -4746,7 +5085,7 @@ private struct FfiConverterDictionaryStringString: FfiConverterRustBuffer { let len: Int32 = try readInt(&buf) var dict = [String: String]() dict.reserveCapacity(Int(len)) - for _ in 0 ..< len { + for _ in 0..=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public struct FfiConverterTypeUuid: FfiConverter { + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Uuid { let builtinValue = try FfiConverterString.read(from: &buf) return UUID(uuidString: builtinValue)! @@ -4786,18 +5129,19 @@ public struct FfiConverterTypeUuid: FfiConverter { } } + #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeUuid_lift(_ value: RustBuffer) throws -> Uuid { - try FfiConverterTypeUuid.lift(value) + return try FfiConverterTypeUuid.lift(value) } #if swift(>=5.8) - @_documentation(visibility: private) +@_documentation(visibility: private) #endif public func FfiConverterTypeUuid_lower(_ value: Uuid) -> RustBuffer { - FfiConverterTypeUuid.lower(value) + return FfiConverterTypeUuid.lower(value) } /** @@ -4811,13 +5155,12 @@ public func FfiConverterTypeUuid_lower(_ value: Uuid) -> RustBuffer { * When there are now more locations to visit, returns the same state forever. */ public func advanceLocationSimulation(state: LocationSimulationState) -> LocationSimulationState { - try! FfiConverterTypeLocationSimulationState.lift(try! rustCall { - uniffi_ferrostar_fn_func_advance_location_simulation( - FfiConverterTypeLocationSimulationState.lower(state), $0 - ) - }) + return try! FfiConverterTypeLocationSimulationState.lift(try! rustCall() { + uniffi_ferrostar_fn_func_advance_location_simulation( + FfiConverterTypeLocationSimulationState.lower(state),$0 + ) +}) } - /** * Creates a [`RouteResponseParser`] capable of parsing OSRM responses. * @@ -4826,13 +5169,12 @@ public func advanceLocationSimulation(state: LocationSimulationState) -> Locatio * which contain richer information like banners and voice instructions for navigation. */ public func createOsrmResponseParser(polylinePrecision: UInt32) -> RouteResponseParser { - try! FfiConverterTypeRouteResponseParser.lift(try! rustCall { - uniffi_ferrostar_fn_func_create_osrm_response_parser( - FfiConverterUInt32.lower(polylinePrecision), $0 - ) - }) + return try! FfiConverterTypeRouteResponseParser.lift(try! rustCall() { + uniffi_ferrostar_fn_func_create_osrm_response_parser( + FfiConverterUInt32.lower(polylinePrecision),$0 + ) +}) } - /** * Creates a [`Route`] from OSRM data. * @@ -4840,103 +5182,85 @@ public func createOsrmResponseParser(polylinePrecision: UInt32) -> RouteResponse * supporting both vanilla OSRM and enhanced Valhalla (ex: from Stadia Maps and Mapbox) outputs * which contain richer information like banners and voice instructions for navigation. */ -public func createRouteFromOsrm(routeData: Data, waypointData: Data, polylinePrecision: UInt32) throws -> Route { - try FfiConverterTypeRoute.lift(rustCallWithError(FfiConverterTypeParsingError.lift) { - uniffi_ferrostar_fn_func_create_route_from_osrm( - FfiConverterData.lower(routeData), - FfiConverterData.lower(waypointData), - FfiConverterUInt32.lower(polylinePrecision), $0 - ) - }) +public func createRouteFromOsrm(routeData: Data, waypointData: Data, polylinePrecision: UInt32)throws -> Route { + return try FfiConverterTypeRoute.lift(try rustCallWithError(FfiConverterTypeParsingError.lift) { + uniffi_ferrostar_fn_func_create_route_from_osrm( + FfiConverterData.lower(routeData), + FfiConverterData.lower(waypointData), + FfiConverterUInt32.lower(polylinePrecision),$0 + ) +}) } - /** * Creates a [`RouteRequestGenerator`] * which generates requests to an arbitrary Valhalla server (using the OSRM response format). * * This is provided as a convenience for use from foreign code when creating your own [`routing_adapters::RouteAdapter`]. */ -public func createValhallaRequestGenerator(endpointUrl: String, profile: String, - optionsJson: String?) throws -> RouteRequestGenerator -{ - try FfiConverterTypeRouteRequestGenerator.lift(rustCallWithError(FfiConverterTypeInstantiationError.lift) { - uniffi_ferrostar_fn_func_create_valhalla_request_generator( - FfiConverterString.lower(endpointUrl), - FfiConverterString.lower(profile), - FfiConverterOptionString.lower(optionsJson), $0 - ) - }) +public func createValhallaRequestGenerator(endpointUrl: String, profile: String, optionsJson: String?)throws -> RouteRequestGenerator { + return try FfiConverterTypeRouteRequestGenerator.lift(try rustCallWithError(FfiConverterTypeInstantiationError.lift) { + uniffi_ferrostar_fn_func_create_valhalla_request_generator( + FfiConverterString.lower(endpointUrl), + FfiConverterString.lower(profile), + FfiConverterOptionString.lower(optionsJson),$0 + ) +}) } - /** * Helper function for getting the route as an encoded polyline. * * Mostly used for debugging. */ -public func getRoutePolyline(route: Route, precision: UInt32) throws -> String { - try FfiConverterString.lift(rustCallWithError(FfiConverterTypeModelError.lift) { - uniffi_ferrostar_fn_func_get_route_polyline( - FfiConverterTypeRoute.lower(route), - FfiConverterUInt32.lower(precision), $0 - ) - }) +public func getRoutePolyline(route: Route, precision: UInt32)throws -> String { + return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeModelError.lift) { + uniffi_ferrostar_fn_func_get_route_polyline( + FfiConverterTypeRoute.lower(route), + FfiConverterUInt32.lower(precision),$0 + ) +}) } - /** * Creates a location simulation from a set of coordinates. * * Optionally resamples the input line so that there is a maximum distance between points. */ -public func locationSimulationFromCoordinates( - coordinates: [GeographicCoordinate], - resampleDistance: Double?, - bias: LocationBias -) throws -> LocationSimulationState { - try FfiConverterTypeLocationSimulationState.lift(rustCallWithError(FfiConverterTypeSimulationError.lift) { - uniffi_ferrostar_fn_func_location_simulation_from_coordinates( - FfiConverterSequenceTypeGeographicCoordinate.lower(coordinates), - FfiConverterOptionDouble.lower(resampleDistance), - FfiConverterTypeLocationBias.lower(bias), $0 - ) - }) +public func locationSimulationFromCoordinates(coordinates: [GeographicCoordinate], resampleDistance: Double?, bias: LocationBias)throws -> LocationSimulationState { + return try FfiConverterTypeLocationSimulationState.lift(try rustCallWithError(FfiConverterTypeSimulationError.lift) { + uniffi_ferrostar_fn_func_location_simulation_from_coordinates( + FfiConverterSequenceTypeGeographicCoordinate.lower(coordinates), + FfiConverterOptionDouble.lower(resampleDistance), + FfiConverterTypeLocationBias.lower(bias),$0 + ) +}) } - /** * Creates a location simulation from a polyline. * * Optionally resamples the input line so that there is no more than the specified maximum distance between points. */ -public func locationSimulationFromPolyline( - polyline: String, - precision: UInt32, - resampleDistance: Double?, - bias: LocationBias -) throws -> LocationSimulationState { - try FfiConverterTypeLocationSimulationState.lift(rustCallWithError(FfiConverterTypeSimulationError.lift) { - uniffi_ferrostar_fn_func_location_simulation_from_polyline( - FfiConverterString.lower(polyline), - FfiConverterUInt32.lower(precision), - FfiConverterOptionDouble.lower(resampleDistance), - FfiConverterTypeLocationBias.lower(bias), $0 - ) - }) +public func locationSimulationFromPolyline(polyline: String, precision: UInt32, resampleDistance: Double?, bias: LocationBias)throws -> LocationSimulationState { + return try FfiConverterTypeLocationSimulationState.lift(try rustCallWithError(FfiConverterTypeSimulationError.lift) { + uniffi_ferrostar_fn_func_location_simulation_from_polyline( + FfiConverterString.lower(polyline), + FfiConverterUInt32.lower(precision), + FfiConverterOptionDouble.lower(resampleDistance), + FfiConverterTypeLocationBias.lower(bias),$0 + ) +}) } - /** * Creates a location simulation from a route. * * Optionally resamples the route geometry so that there is no more than the specified maximum distance between points. */ -public func locationSimulationFromRoute(route: Route, resampleDistance: Double?, - bias: LocationBias) throws -> LocationSimulationState -{ - try FfiConverterTypeLocationSimulationState.lift(rustCallWithError(FfiConverterTypeSimulationError.lift) { - uniffi_ferrostar_fn_func_location_simulation_from_route( - FfiConverterTypeRoute.lower(route), - FfiConverterOptionDouble.lower(resampleDistance), - FfiConverterTypeLocationBias.lower(bias), $0 - ) - }) +public func locationSimulationFromRoute(route: Route, resampleDistance: Double?, bias: LocationBias)throws -> LocationSimulationState { + return try FfiConverterTypeLocationSimulationState.lift(try rustCallWithError(FfiConverterTypeSimulationError.lift) { + uniffi_ferrostar_fn_func_location_simulation_from_route( + FfiConverterTypeRoute.lower(route), + FfiConverterOptionDouble.lower(resampleDistance), + FfiConverterTypeLocationBias.lower(bias),$0 + ) +}) } private enum InitializationResult { @@ -4944,7 +5268,6 @@ private enum InitializationResult { case contractVersionMismatch case apiChecksumMismatch } - // Use a global variable to perform the versioning checks. Swift ensures that // the code inside is only computed once. private var initializationResult: InitializationResult = { @@ -4955,61 +5278,61 @@ private var initializationResult: InitializationResult = { if bindings_contract_version != scaffolding_contract_version { return InitializationResult.contractVersionMismatch } - if uniffi_ferrostar_checksum_func_advance_location_simulation() != 26307 { + if (uniffi_ferrostar_checksum_func_advance_location_simulation() != 26307) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_func_create_osrm_response_parser() != 16550 { + if (uniffi_ferrostar_checksum_func_create_osrm_response_parser() != 16550) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_func_create_route_from_osrm() != 42270 { + if (uniffi_ferrostar_checksum_func_create_route_from_osrm() != 42270) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_func_create_valhalla_request_generator() != 16275 { + if (uniffi_ferrostar_checksum_func_create_valhalla_request_generator() != 16275) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_func_get_route_polyline() != 31480 { + if (uniffi_ferrostar_checksum_func_get_route_polyline() != 31480) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_func_location_simulation_from_coordinates() != 52416 { + if (uniffi_ferrostar_checksum_func_location_simulation_from_coordinates() != 52416) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_func_location_simulation_from_polyline() != 14615 { + if (uniffi_ferrostar_checksum_func_location_simulation_from_polyline() != 14615) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_func_location_simulation_from_route() != 39027 { + if (uniffi_ferrostar_checksum_func_location_simulation_from_route() != 39027) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_method_navigationcontroller_advance_to_next_step() != 3820 { + if (uniffi_ferrostar_checksum_method_navigationcontroller_advance_to_next_step() != 3820) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_method_navigationcontroller_get_initial_state() != 63862 { + if (uniffi_ferrostar_checksum_method_navigationcontroller_get_initial_state() != 63862) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_method_navigationcontroller_update_user_location() != 3165 { + if (uniffi_ferrostar_checksum_method_navigationcontroller_update_user_location() != 3165) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_method_routeadapter_generate_request() != 59034 { + if (uniffi_ferrostar_checksum_method_routeadapter_generate_request() != 59034) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_method_routeadapter_parse_response() != 34481 { + if (uniffi_ferrostar_checksum_method_routeadapter_parse_response() != 34481) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_method_routedeviationdetector_check_route_deviation() != 50476 { + if (uniffi_ferrostar_checksum_method_routedeviationdetector_check_route_deviation() != 50476) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_method_routerequestgenerator_generate_request() != 63458 { + if (uniffi_ferrostar_checksum_method_routerequestgenerator_generate_request() != 63458) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_method_routeresponseparser_parse_response() != 44735 { + if (uniffi_ferrostar_checksum_method_routeresponseparser_parse_response() != 44735) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_constructor_navigationcontroller_new() != 60881 { + if (uniffi_ferrostar_checksum_constructor_navigationcontroller_new() != 60881) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_constructor_routeadapter_new() != 32290 { + if (uniffi_ferrostar_checksum_constructor_routeadapter_new() != 32290) { return InitializationResult.apiChecksumMismatch } - if uniffi_ferrostar_checksum_constructor_routeadapter_new_valhalla_http() != 3524 { + if (uniffi_ferrostar_checksum_constructor_routeadapter_new_valhalla_http() != 3524) { return InitializationResult.apiChecksumMismatch } @@ -5030,4 +5353,4 @@ private func uniffiEnsureInitialized() { } } -// swiftlint:enable all +// swiftlint:enable all \ No newline at end of file diff --git a/common/Cargo.lock b/common/Cargo.lock index e8c6185f..78cbf3a0 100644 --- a/common/Cargo.lock +++ b/common/Cargo.lock @@ -1476,6 +1476,13 @@ dependencies = [ "uniffi", ] +[[package]] +name = "uniffi-bindgen-swift" +version = "0.1.0" +dependencies = [ + "uniffi", +] + [[package]] name = "uniffi_bindgen" version = "0.28.2" diff --git a/common/Cargo.toml b/common/Cargo.toml index e37c1ff4..9ea4ab43 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ "uniffi-bindgen", + "uniffi-bindgen-swift", "ferrostar", ] resolver = "2" diff --git a/common/build-ios.sh b/common/build-ios.sh index 8c6d53dd..850c20fa 100755 --- a/common/build-ios.sh +++ b/common/build-ios.sh @@ -32,10 +32,11 @@ fat_simulator_lib_dir="target/ios-simulator-fat/release" generate_ffi() { echo "Generating framework module mapping and FFI bindings" - cargo run -p uniffi-bindgen generate --library target/aarch64-apple-ios/release/lib$1.dylib --language swift --out-dir target/uniffi-xcframework-staging + # NOTE: Convention requires the modulemap be named module.modulemap + cargo run -p uniffi-bindgen-swift -- target/aarch64-apple-ios/release/lib$1.a target/uniffi-xcframework-staging --swift-sources --headers --modulemap --module-name $1FFI --modulemap-filename module.modulemap mkdir -p ../apple/Sources/UniFFI/ mv target/uniffi-xcframework-staging/*.swift ../apple/Sources/UniFFI/ - mv target/uniffi-xcframework-staging/$1FFI.modulemap target/uniffi-xcframework-staging/module.modulemap # Convention requires this have a specific name + mv target/uniffi-xcframework-staging/module.modulemap target/uniffi-xcframework-staging/module.modulemap } create_fat_simulator_lib() { diff --git a/common/uniffi-bindgen-swift/Cargo.toml b/common/uniffi-bindgen-swift/Cargo.toml new file mode 100644 index 00000000..9e4ac3a9 --- /dev/null +++ b/common/uniffi-bindgen-swift/Cargo.toml @@ -0,0 +1,18 @@ +lints.workspace = true + +[package] +name = "uniffi-bindgen-swift" +version = "0.1.0" +authors.workspace = true +license.workspace = true +edition.workspace = true +repository.workspace = true +rust-version.workspace = true +publish = false + +[dependencies] +uniffi = { workspace = true, features = ["cli"] } + +[[bin]] +name = "uniffi-bindgen" +path = "src/main.rs" diff --git a/common/uniffi-bindgen-swift/src/main.rs b/common/uniffi-bindgen-swift/src/main.rs new file mode 100644 index 00000000..b1b0d730 --- /dev/null +++ b/common/uniffi-bindgen-swift/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + uniffi::uniffi_bindgen_swift(); +}