Unpacking Types over function channel

Consider the following:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=cd75b701e27cc24f26137f762b3646e1

What is a better way to go about this? I want to handle both types in my rec function.

Something like this or this?

So I like the second example however I still run into the problem if trying to recreate the object VxHeader<T>

You really have to explain what you're trying to do in more detail. Why do you need a generic parameter?

Like Alice said, maybe identifying what you'd like done would help us help you. Here, I tried filling-in-the-gaps of what I might of wanted in your position, although I would do it differently. Regardless:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7768b734c0898db7980b1596e83567f0

1 Like

Would something like this work using trait objects playgound. It would remove the need for explicit generics but give you the same flexibility as long as every V* struct impl's the VxType.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.