Rust is the reddish brittle coating formed on iron when it is attacked by moist air. It is composed mainly of hydrated ferric oxide.
Rusting is the electrochemical corrosion of the iron metal by the attack of oxygen and moisture.
Painting prevents corrosion as it prevents oxygen coming in contact with the metal.