Personally, it is dangerous to rub your eyes while wearing contact lenses. In details, rubbing your eyes when you wear contact lenses will pushes the dirt or dust into the lens. That can cause infection to the eyes. Or if you rub your eyes to much, it may cause the scratches to the contact lenses even broken the contact lenses in your eyes. That is very risks to your eyes. So, you'd better not rub your eyes to when you wearing contact lenses.
When you are wearing contacts, you'd better not rub your eyes, because it may cause some bacteria to your eyes. You can drop some eye drop to your eye make it feel more comfortable. If it still can't work, you can rub gently. To me, when I happen to this situation, I deal with it gently, and never have been problems.
Don't do that again. It is obviously bad to your eyes. Rubbing eyes is a hurt to eyes, it will causes astigmatism, which is one important reason of myopic eye. Especially when you are wearing contacts, it is unhealthful, maybe cause eye infections. Remember that don't do that again for your health eyes.
I suggest you'd better not. As we all know, wearing contacts for a long time will make our eyes very dry and tired. If you keep rubbing your eyes while wearing contact lenses, you may hurt your eyes. Because the lenses are dry and it may scratch your cornea, thus make you have some eye disease.
In my personal view, I think you'd better not to rub your eyes because if you are a beginner to wear contacts, it could fall out after your rubbing. If the contacts fall out of your eyes, it may be dangerous for your eyes. Although normally you can rub your eyes if you cannot bear your itch, you must rub them softly and gently.