Error detection for iced::widget::image

⚓ Rust    📅 2025-10-07    👤 surdeus    👁️ 11      

surdeus

Warning

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

I'm new to rust in general. Sorry if this question is overly basic.

I'm trying to display an image using the iced library:

fn view(self: &UI) -> iced::Element<'_, Message> {
  iced::widget::image("res/imgs/Monument_valley_by_orbitelambda.jpg").into()
}

This works fine in the happy case. However if the referenced file either doesn't exist, or is not a valid image file, the program will just display a blank window. I would like some way to handle the error cases; but I cannot find any indication of how to do so in the docs.

1 post - 1 participant

Read full topic

🏷️ Rust_feed