Set a direction, not a goal and just keep going.
It's not like I thought of every direction as a learning opportunity and it's not like I was training to embrace failure. If failure occurred there was always a way to adapt to a different direction. Some times that meant re doing large parts of code, but there was generally no reason to quit overall.
It makes sense as a self taught programmer who had little to some clue what they are doing. Just do it was the innate mantra. Failure was part of the journey not a destination, so recover by exploring alternatives from where you currently are.
I tend to do this with Rust and new projects a lot and maybe that's why I like doing these a lot.