PortInitializableByServiceName
A port that can be initialized by looking up a service name.
protocol PortInitializableByServiceName : Mach.Port
Browse conforming typesConformance to this protocol allows a custom port class to represent a specific service from the bootstrap server like so:
class CustomPort: Mach.PortInitializableByServiceName {
convenience init() throws {
self.init(serviceName: "some.service.name")
}
}
The init(serviceName:)
initializer has a default implementation that uses the bootstrap server to look up the given service name and obtain a send right to it, placing the name of the send right into the name
property. Therefore, an instance of CustomPort
above can be used to send messages to the service named some.service.name
.