Move.

Publicación

Comparte tu conocimiento.

skywinder.
Jan 23, 2025
P&R expertos

How to resolve mutable borrow error in Rust function?

I'm encountering an error while trying to get a value from an object in two places within the same Rust function. The error states it's still being mutably borrowed. How do I resolve this?

  • Move CLI
3
2
Cuota
Comentarios
.

Respuestas

2
Xavier.eth.
Jan 23 2025, 15:56

b1_objPara resolver esto, asegúrate de que la primera referencia mutable (b2_obj) esté fuera del alcance antes de intentar volver a tomar prestado el objeto con la segunda referencia mutable ().

3
Mejor Respuesta
Comentarios
.
Grizzly.
Jan 23 2025, 09:10

Este error se produce porque no puede tener más de una referencia mutable al mismo objeto al mismo tiempo en Rust.

1
Comentarios
.

Sabes la respuesta?

Inicie sesión y compártalo.

Move is an executable bytecode language used to implement custom transactions and smart contracts.

148Publicaciones231Respuestas
Sui.X.Peera.

Gana tu parte de 1000 Sui

Gana puntos de reputación y obtén recompensas por ayudar a crecer a la comunidad de Sui.

Campaña de RecompensasJulio