I've tried to follow to shifting model of pointers in Swift (I understand it's for the best)… but now I'm completly lost.
How would I cast/convert a `sockaddr_in6` to an `UnsafePointer<sockaddr>!` type?
var s = sockaddr_in6()
// ... assign values members/properties of `s`
var fileDescriptor = socket(socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP)
// ... handle errors
Darwin.bind(fileDescriptor, &s ,socklen_t(MemoryLayout<sockaddr_in6>.size))
// ^^ ###### can't convert sockaddr_in6 to sockaddr
I've tried many things without success (withUnsafePointer(…), OpaquePointers<T>, etc.).
My (current) understanding is that I would need to go from:
sockaddr_in6 ⇒ UnsafePointer<sockaddr_in6> ⇒ UnsafePointer<sockaddr>!
But there doesn't seem to be anyway to cast UnsafePointer between themselves. I'm sure there's a logical reason somehwere but it eludes me.
Thank you!