mirror of
https://github.com/luxfi/safe-ios.git
synced 2026-10-30 15:19:20 +00:00
24 lines
626 B
Swift
24 lines
626 B
Swift
//
|
|
// Created by Dmitry Bespalov on 06.02.22.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
func wrap<T>(completion: @escaping (Result<T, Error>) -> Void) -> (Result<NodeQuantity<T>, Error>) -> Void where T: FixedWidthInteger {
|
|
{ result in
|
|
let newResult = result.map { quantity -> T in
|
|
quantity.value
|
|
}
|
|
completion(newResult)
|
|
}
|
|
}
|
|
|
|
func wrap<T>(completion: @escaping (Result<T, Error>) -> Void) -> (Result<NodeData<T>, Error>) -> Void where T: NodeDataCodable {
|
|
{ result in
|
|
let newResult = result.map { quantity -> T in
|
|
quantity.value
|
|
}
|
|
completion(newResult)
|
|
}
|
|
}
|