Is it possible to define a topology on a set such that continuity of a map out of this space implies that map is an isometry?

I understand that the use of defining a topology on a set is to define what it means for a map out of the space to be continuous. It is then natural to ask for which types of maps out of a set is it possible to define a topology on the set to allow only said maps to be continuous (e.g. any map continuity -> discrete topology, ‘traditional’ continuity -> euclidean topology).

This has not yet been addressed in the textbook I am currently reading so I decided to take it here.

My question is specifically about isometric maps, but any more general answer will suffice.