Skip to content

[Rustonomicon] Show how to convert a trait object into concrete type  #28571

Closed
@Havvy

Description

@Havvy

Last night somebody asked how to convert a trait object where they knew the concrete type into the concrete type. I tried looking for the answer in the Rustonomicon, but alas, no answer was found. Should this be in there?

The answer has to do with transmuting into std::raw::TraitObject. Even if it's just a link to that type from the transmutation page, I think it's important to explicitly show that it is possible. One issue though, is that std::raw::TraitObject is currently unstable as per issue #27751.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions