Here's another thing to consider: how accessible is your gun?
I know on my duty rig, where my sidearm is openly carried, I can fairly easily draw and fire within the time it takes someone to rush me with a knife from 21 feet - if I'm expecting it. I also know that, if they're at 21 feet, it doesn't matter if I hit him; unless I put a round right through his forehead, I'm fairly guaranteed to get cut/stabbed.
Now, factor in drawing from concealment. Factor in drawing against someone who has already taken the initiative to attack you, someone who is rushing you RIGHT NOW with a cutting or stabbing tool. Or even a club.
You're going to take a moment to recognize the threat, decide on a reaction, and perform the reaction. You're probably going to get cut, stabbed, or whacked. You're probably going to bleed.
That being said, there are a couple things one can do to "practice" for this. The first is the side-step, or "off-lining" as I was taught. Regardless of the martial art, whether hand-and-foot or gunpowder-and-lead, the ability to off-line is fairly crucial in avoiding or lessening the impact of whatever attack is coming at you. Once the attacker has committed to the rush, he has to fight his own momentum in order to change direction. Stepping to the side, while you may still get whacked or cut, removes you from his immediate front, and he has to change direction in order to continue. It also gets your head and vital organs out from his funnel. There's several things one can do here, from trying to trip him (which, of course, can also take you down if not done right), to spinning around behind him, to continuing to the side to escape or maneuver for distance and advantage. These things are probably better told by actual instructor (although I have stayed at a few non-Holiday Inns in my time).
The second is the snap-shot from the hip. My job does not train for "long distance" instinctive shots, but we do work at close-up draw-and-fire drills, from as close as four feet. It's not a perfect solution. It's far from perfect. If you're good, if your gun is easily accessible, drawing from concealment is probably going to take most, if not all, of the time it takes for an attacker to cover 21 feet, and possibly then some. However, it's still useful. If you practice (carefully, of course! - we don't want to see any of US on Youtube!), at drawing and "hip-shooting" at close-range, you'll have an idea of where your bullet will land, and what your gun will do. Don't get any ideas of hip-shooting the knife out of his hand; we're not CASS shooters, and that kind of trick shot is incredibly difficult even under the best of circumstances. However, if you practice off-lining, then off-lining while drawing (empty guns or preferably dummy guns, please! - remember Youtube is not your friend!), then you may be able to get out of the way with only a cut on your arm, and get the gun into play before he comes back again for a second run.
Actual training in these is, again, probably best performed under the auspices of a qualified instructor, not the advice of some dude on the internet with an opinion, of course.