How can I keep hard edges with this shape?
The easiest way would be to delete top faces, extrude rim and close the cup in different way, but if you want to keep quads, use bevel edge, by selecting outer edge and pressing CTRL+B and moving mouse to set bevel size.Her are both ways: