How can I limit a specific resource to a cargo wagon?

Solution 1:

You can restrict the slots of the coal cargo wagon to only allow coal (middle-click by default). If it already contains coal, it won't even ask what should go into that slot.

In the newest version trains can be blueprinted, so you might even be able to make a blueprint of the cargo wagon with the restricted slots, and make copies with already-restricted slots. But I haven't tried this since train blueprints are rather new.