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

Downcast an owned boxed value? #8

Closed
mdg opened this issue Aug 23, 2017 · 1 comment
Closed

Downcast an owned boxed value? #8

mdg opened this issue Aug 23, 2017 · 1 comment

Comments

@mdg
Copy link

mdg commented Aug 23, 2017

Is it possible to downcast an owned boxed value instead of a ref?

Something like:

let p: Box<Person> = person_alice;
let alice: Option<Box<Alice>> = Mopa.downcast_box::<Alice>(p);
@chris-morgan
Copy link
Owner

p.downcast::<Alice>() will get you an Result<Box<Alice>, Box<Person>>.

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