Whisk egg yolks, sugar and vanilla in a bowl. Whisk in cornflour and flour. Add milk, 1/4 cup at a time, whisking well after each addition. Transfer to a saucepan and cook, stirring constantly, over medium heat for 10 minutes or until custard comes to the boil. Pour custard into a heatproof bowl. Cover the surface with plastic wrap. Refrigerate until cold. Beat lightly to loosen the custard.
For the doughnuts; Combine the flour, yeast, sugar, and a good pinch salt in a bowl of a stand mixer. Add the milk, butter and egg yolk. Beat on low speed with dough hook until combined. Beat on low for further 5 minutes until dough is smooth and elastic, but still sticky. Place the dough in a lightly oiled bowl, turning once to coat the top of the dough with oil. Cover with plastic wrap and tea towel. Set aside to rise in a warm place for 1 hour or until doubled in size.
When the dough is ready, turn out onto a lightly floured bench. Knead gently until smooth. Divide dough into 24 equal portions. Roll each into a smooth ball. Place on a lined baking tray. Cover with plastic wrap. Set aside 30-45 minutes until they almost double in size.
Crush the raspberries with a fork. Heat oil in a medium, deep saucepan to 160°C. Fry the doughnuts 4 at a time, turning constantly for about 4, turning until golden. Remove with a slotted spoon to a tray scattered with the white sugar, turn to coat in immediately.
Cut a slit in the top of each doughnut. Spoon in custard. Top with crushed raspberries. Serve.