Skip to content

Conversation

@Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Apr 17, 2018

Motivation:

When implementing a custom ChannelCore, you will probably need access
to the data inside a NIOAny. It should be possible to unwrap that.

Modifications:

Added an extension to ChannelCore to allow unwrapping a NIOAny.
Added @_versioned to almost all of NIOAny.

Result:

ChannelCore is implementable outside NIO

@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Apr 17, 2018
@Lukasa Lukasa requested review from normanmaurer and weissi April 17, 2018 14:54
/// Try unwrapping the wrapped message as `ByteBuffer`.
///
/// returns: The wrapped `ByteBuffer` or `nil` if the wrapped message is not a `ByteBuffer`.
@_versioned
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lukasa why not @_inlineable as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current reason is that storage is private. Do we think that's worth changing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lukasa not for this particular one but possibly for the ones that take generics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm a bit on the fence here. I suppose making the storage internal won't be too big a deal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me too tbh. I'll make it your call. If you make the storage internal, please underscore it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, made all of these @_inlineable.

@Lukasa Lukasa force-pushed the cb-channelcore-unwrap-nioany branch from 320c382 to b5f9d06 Compare April 17, 2018 15:54
Copy link
Member

@normanmaurer normanmaurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit...

}

public extension ChannelCore {
/// Unwraps the given NIOAny as a specific concrete type.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back-ticks around NIOAny

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied.

Motivation:

When implementing a custom ChannelCore, you will probably need access
to the data inside a NIOAny. It should be possible to unwrap that.

Modifications:

Added an extension to ChannelCore to allow unwrapping a NIOAny.
Added @_versioned to almost all of NIOAny.

Result:

ChannelCore is implementable outside NIO
@Lukasa Lukasa force-pushed the cb-channelcore-unwrap-nioany branch from b5f9d06 to 5b11619 Compare April 17, 2018 18:10
@weissi
Copy link
Member

weissi commented Apr 17, 2018

test failure should be addressed by #326

@weissi
Copy link
Member

weissi commented Apr 17, 2018

@swift-nio-bot test this please

@Lukasa Lukasa added this to the 1.5.0 milestone Apr 18, 2018
@Lukasa Lukasa merged commit 9326f74 into apple:master Apr 18, 2018
@Lukasa Lukasa deleted the cb-channelcore-unwrap-nioany branch April 18, 2018 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants