  This work investigates the structure of rank-metric codes in connection with
concepts from finite geometry, most notably the $q$-analogues of projective
systems and blocking sets. We also illustrate how to associate a classical
Hamming-metric code to a rank-metric one, in such a way that various
rank-metric properties naturally translate into the homonymous Hamming-metric
notions under this correspondence. The most interesting applications of our
results lie in the theory of minimal rank-metric codes, which we introduce and
study from several angles. Our main contributions are bounds for the parameters
of a minimal rank-metric codes, a general existence result based on a
combinatorial argument, and an explicit code construction for some parameter
sets that uses the notion of a scattered linear set. Throughout the paper we
also show and comment on curious analogies/divergences between the theories of
error-correcting codes in the rank and in the Hamming metric.
