How to create a sprite reference variable

In the following code:

// sprite is assigned to variable
let mut br_sprite = Sprite::from_texture(br_tex.clone());

I will have many of these sprites, so I want to do this:

let mut generic_sprite = &br_sprite;

....and the reason I'm assigning the reference of br_sprite is so it will not be moved into the generic sprite variable, so I may use br_sprite again later..... I want use the generic_sprite var in an event loop so whatever sprite I assign to generic_sprite will be used like this:

generic_sprite.set_position(loc[0], loc[1]);

but when I do the

 generic_sprite.set_position(loc[0], loc[1]); 

statement I get:

cannot borrow `*generic_sprite` as mutable, as it is behind a `&` reference
cannot borrow as mutablerustc(E0596)

so how do I do it? (get the generic_sprite idea to work)

SamQ

Use let generic_sprite = &mut br_sprite;. let mut generic_sprite = &br_sprite; allows you to change generic_sprite itself, but not what it is pointing to.

Also please use code blocks. (You can edit your post)

```rust
fn foo() {}
```

THANK YOU SO MUCH bjorn3!!! This helped me understand Rust better!