You've sent your best work to an editor. They can say one of three things: 1. Yes, we'd like to contract the manuscript, 2. the story is great, but please fix the aforementioned things and resubmit, or 3. thank you for your submission, but it's not what we are looking for/contracting at this time.
The first one is fabulous.
The second one... well, it hurts, but you have the option to resubmit.
The third one... yeah, that one hurts.
As a fellow writer, I can tell you I've felt the high of the first one, the tumult of the second one, and the sting of the third one firsthand.
If you get a rejection or suggestion for a resubmission, don't freak out. I know that sounds like the impossible. It's not. Trust me.
I always allow myself the time to wallow in pity. You almost need it. Your ego probably took a serious hit.
With a rejection, many companies won't tell you what was wrong with the MS, but some will. Those who do, take heed and READ, really read what they have to say. Chances are, the things they point out will sink you with any other editor. These are the big things, like telling not showing, too much passive voice, lack of details, too many details.
With an invitation to resubmit, most of the time the editor will tell you what the issues were and some will suggest how to fix them. If they ask for a resub, then you have something going for you in the story that they want to work with - they see the diamond in the rough. There is no guarantee that they will accept the work once you rework it, but you have that second chance you don't have with a simple rejection.
When I've resubmitted, I try to strike while the fire is hot, but that doesn't mean you can't take your time and do the reworking right. And yes, I've resubmitted and had the second go-round rejected.
One thing: don't automatically resubmit without doing changes. The editors do touch base with the head editor.
Another thing: don't shut down because the editor didn't want it. What one editor loves will be the bane of another editor's existence. What he/she might take on one day might be the thing she's sick of the next day. If you give up and let your bruised ego take over before you get a chance to really look at the comments, you're shortchanging yourself.
I always go back with a clear head and read what the editor says. When upset, the comments may seem overwhelming and personal, but when read in the light of a new day might make perfect sense - kind of an "oh, duh, that did need changed".
Last thing for now - even the multi-published authors get rejected once in a while. It's true. The editors don't have it out for you, but today might not be the day for your story. Who knows... tomorrow's hot hit might have to do with your story and you'll have it made.
Never give up.