  When a category $\mathcal{C}$ satisfies certain conditions, we define the
notion of rank invariant for arbitrary poset-indexed functors $F:\mathbf{P}
\rightarrow \mathcal{C}$ from a category theory perspective. This generalizes
the standard notion of rank invariant as well as Patel's recent extension.
Specifically, the barcode of any interval decomposable persistence modules
$F:\mathbf{P} \rightarrow \mathbf{vec}$ of finite dimensional vector spaces can
be extracted from the rank invariant by the principle of inclusion-exclusion.
Generalizing this idea allows freedom of choosing the indexing poset
$\mathbf{P}$ of $F: \mathbf{P} \rightarrow \mathcal{C}$ in defining Patel's
generalized persistence diagram of $F$. Of particular importance is the fact
that the generalized persistence diagram of $F$ is defined regardless of
whether $F$ is interval decomposable or not. By specializing our idea to zigzag
persistence modules, we also show that the barcode of a Reeb graph can be
obtained in a purely set-theoretic setting without passing to the category of
vector spaces. This leads to a promotion of Patel's semicontinuity theorem
about type $\mathcal{A}$ persistence diagram to Lipschitz continuity theorem
for the category of sets.
