Get Option from Vec by index without moving

⚓ Rust    📅 2025-04-24    👤 surdeus    👁️ 8      

surdeus

Warning

This post was published 119 days ago. The information described in this article may have changed.

Hello! I've created a play for my program

Briefly: I have a Vec<Option<Box<dyn SomeTrait>>> and want to get an element by index to send it to a function. And I don't wanna to take this element - the source Vec should be untouched. How can I do this?

6 posts - 4 participants

Read full topic

🏷️ rust_feed