... that's because it is a duplicate. If you have a SocketAddr, and you want to access the SocketAddrV6 variant, remembering that you may also have a SocketAddrV4, you need an if let:
if let V6(sock6) = addr {
// use sock6: SocketAddrV6
}
By intentional design, Stack Overflow is a poor site to use if you need to work through multiple questions and answers to solve a problem. There are other sites that work to fill in that approach and do so better.
Stack Overflow works best when there is a well defined problem that can be reproduced and you are a specific answer rather than guidance for how to proceed or a tutorial.
If someone needs to come back to a question to answer comments and work through it, SO becomes more and more difficult to use in that format. AN important thing to remember is that it isn't the right site for every question (and trying to use it as such will run into those intentional design choices made at the very start to make it difficult to use for certain types of questions).
I don't understand your response. I asked a single very specific question. Everything else was context and to prove that I did some work on my end before asking for help.
I would have to look again, but I believe that SO explicitly asks you to post what you tried. And now you're saying that posting what I tried muddies up the value of my question. Can you see how this seems like a no-win situation?
Edit: Also, my question was marked as a duplicate. It doesn't seem to have been rejected for reasons related to asking too many questions or requiring a tutorial answer.
> I would appreciate any guidance to get me moving in the right direction.
And then in a comment:
> @Lukas, I had seen your solution, but you didn't actually explain the syntax, and I couldn't wrap my brain around it. I tried again today, and I think I have something which appears to be working, although I still don't understand the syntax.
The Q&A part of SO doesn't work well with back and forth communication but rather "here is a question, assume this is the final form, try to answer it and move on." There is far too much material there for people to try to curate and cultivate the questions and answers too much.
> I would appreciate any guidance to get me moving in the right direction.
This is standard polite phrasing indicating that I would be happy with any response, regardless of how minimal. I wasn't asking for a tutorial. I don't recall SO requesting me to strip out polite extraneous wording when I made my submission, but perhaps I missed it?
Lukas' solution didn't answer my question. So, yeah, there's going to be back-and-forth when the question wasn't answered. That's what this part was about: "...but you didn't actually explain the syntax..."
And again, my question was flagged as a dupe, not for wording or structure or back-and-forth.
You got a response - that the problem that you have is the same underlying problem as "Unwrap inner type when enum variant is known" (and two other options).
Your edit suggests that it did solve the problem, though it didn't answer the "I don't understand" aspect of the question.
If the solutions given in the linked duplicates didn't work, then specifically applying and showing how they didn't work would be the next step.
> Edit: Based on @Lukas solution, the following seems to compile, but I don't yet know whether it is doing what I want.
Stack Overflow itself is poorly suited for the "explain" type questions - especially if it is going to involve back and forth. The comments are intentionally poorly designed for that. The thing that SO comments are trying to avoid is the forum like "the real answer is buried deeply on page 10 of 15 of 30 comments per page on a phpforum". If the understanding is only uncovered after 50 back and forth comments, then the question and answer themselves are a poor fit for SO.
If you are after that type of interaction and a "here is the answer" isn't going to suffice then other formats may be better for your question. The corresponding difficulty is that Stack Overflow's framework can't be made to handle everything well. It handles Q&A well and doesn't try to handle conversations well.
Your question was marked as a dup because the solution that you are after is in those other Q&A sets.
You will note that if you are trying to find an existing match to your problem, /r/rust and discord are poorly searchable and you might have to scroll through a bunch of comments to try to get the context around the problem... and that is what SO tries to solve.
https://stackoverflow.com/questions/60824493/how-do-you-cast...