Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trait implementation of adapters that cannot accept a socket address? #171

Closed
javaarchive opened this issue May 31, 2024 · 3 comments
Closed

Comments

@javaarchive
Copy link

A bit new to rust, is there any consideration to how transports can be implemented to take in something that is not of SocketAddr type? I am attempting to implement a unix socket adapter and it takes in a path instead of SocketAddr so my current method will likely ignore the SocketAddr but it will still have to be passed.

@lemunozm
Copy link
Owner

lemunozm commented May 31, 2024

You have a RemoteAddr for those cases; could that be useful? Currently, it supports 2 variants but new ones can be added

EDIT. Never mind, you refer to to the one in ConnectionInfo, right?

@javaarchive
Copy link
Author

Basically here the implementation of fn listen_with(config: TransportListen, addr: SocketAddr) takes in SocketAddr which only seems to have IPv4 and IPv6 variants and unix sockets may want to be binded to a file path but for now I am ignoring this parameter initially.
image
As for fixing the ConnectionInfo that is another issue that I am looking into.

@javaarchive
Copy link
Author

I'm going to close this since it seems like on my experiment with a enum that goes between the address types, the SocketAddr for unix sockets is really bad as it doesn't implement any basic traits like Eq or Clone which are needed here even though their underlying types are trivial to derive it for. Likely just going to keep a personal branch of this project that uses a fork of mio for the ugly solution if I need it.

@javaarchive javaarchive closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants