The expected result
Make the 'EventNotification' initializer public for customizing the SocketPool in another package.
The source
In my package FlyingWepoll,
>swift build -c release -j 1
Building for production...
...\Sources\FlyingWepoll\SocketPool+wePoll.swift:167:28: error: 'EventNotification' initializer is inaccessible due to 'internal' protection level
165 | }
166 |
167 | var notification = EventNotification(
| `- error: 'EventNotification' initializer is inaccessible due to 'internal' protection level
168 | file: .init(rawValue: event.data.sock),
169 | events: events,
FlyingSocks.EventNotification.init:2:10: note: 'init(file:events:errors:)' declared here
1 | struct EventNotification {
2 | internal init(file: FlyingSocks.Socket.FileDescriptor, events: FlyingSocks.Socket.Events, errors: Set<FlyingSocks.EventNotification.Error>)}
| `- note: 'init(file:events:errors:)' declared here
The sample
In my package FlyingWepoll,
extension EventNotification {
static func make(from event: epoll_event) -> Self {
let pollEvents = EPOLLEvents(rawValue: Int32(event.events))
var events = Socket.Events()
if pollEvents.contains(.read) {
events.insert(.read)
}
if pollEvents.contains(.write) {
events.insert(.write)
}
var notification = EventNotification(
file: .init(rawValue: event.data.sock),
events: events,
errors: []
)
if !pollEvents.contains(.read) {
if pollEvents.contains(.hup) || pollEvents.contains(.rdhup) {
notification.errors.insert(EventNotification.Error.endOfFile)
}
}
if pollEvents.contains(.err) || pollEvents.contains(.pri) {
notification.errors.insert(EventNotification.Error.error)
}
return notification
}
}
The expected result
Make the 'EventNotification' initializer public for customizing the SocketPool in another package.
The source
In my package
FlyingWepoll,The sample
In my package
FlyingWepoll,