RSTP uses four port roles. Root Port is the same as classic STP. Designated Port is also the same. Alternate Port is a backup to the root port. If your root port fails, the alternate port can take over almost instantly. Backup Port is a backup to a designated port on the same segment, which is rare in modern networks. The explicit alternate role is what enables fast failover. RSTP knows which port to activate before the failure happens.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/network-design/spanning-tree-and-link-aggregation/rstp-port-roles
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████████████████████████████████████████████████████████████████████████████