Building on Jaytar’s fine answer, you may want to avoid line breaks at the right margin.
However, all leader dots I've seen are on the baseline. With this macro based approach, you can change the leaders by just changing the definition of \toclikeentry
.
\documentclass{article}
\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage{showframe} % just for the example
\let\cdotfill\dotfill
\patchcmd{\cdotfill}
{\hss.\hss}
{\hss\textperiodcentered\hss}
{}{}
\newcommand{\changerightskip}{%
\setlength{\rightskip}{3em}%
\setlength{\parfillskip}{-3em}%
}
\newlist{toclikeI}{enumerate}{1}
\setlist[toclikeI]{align=parleft}
\newenvironment{toclike}{\toclikeI\changerightskip}{\endtoclikeI}
\newcommand{\toclikeentry}[3]{\item[#1]#2\cdotfill#3}
\begin{document}
\begin{toclike}%\changerightskip
\toclikeentry{2.1}{An example}{21}
\toclikeentry{2.2}{%
A longer example like this such that the line
wraps down to the next line and the last entry
gets wrapped to the next line}{22}
\toclikeentry{2.31}{Another example}{132}
\end{toclike}
\end{document}