by metabagel · 3y ago · 0 comments
https://stackoverflow.com/questions/60824493/how-do-you-cast...
if let V6(sock6) = addr {
// use sock6: SocketAddrV6
}
The first-linked duplicate answer will answer your question: https://stackoverflow.com/questions/9109872/how-do-you-acces...Searching "rust enum" gives me https://doc.rust-lang.org/rust-by-example/custom_types/enum.... immediately.
Perhaps it is worth it to put it on SO, but it's akin to asking "how do I access the field of an object in JS".
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 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.
This might have been something to work through in a more interactive form such as Stack Overflow Chat - https://chat.stackoverflow.com/transcript/62927/2023/2/8
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.
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.