I'm very much in favor of self-defense, including the use of deadly force when attacked - so on the face of it, I'd say this is a good outcome: he certainly won't be raping anyone else in future!

No law can actually prevent an attack - at best, it might just deter some - for that, your only option is effective self-defense.