How do I get the values from a source rectangle?

How do I access the values from a1 in this line of code?

let a1: Option<[f64; _]> = br_sprite.get_src_rect();

Sam

Depends on how you want to handle errors. If you know that get_src_rect will return a Some (or are just OK with crashing,) you can do

let [a, b, c, d] = a1.unwrap();

If you're in a function returning Option you can use the ? instead of unwrap.

Thank You!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.