Continuous-wave all-optical single-photon transistor based on a Rydberg-atom ensemble