Yes, you can compost mushrooms.
Mushrooms peelings and stalks from the kitchen rot down quickly; whole mushrooms take a little longer but still, not long at all.
Random fungi from around the garden can take longer still if the caps are quite tough and woody (such as birch polypores) — make sure they’re wet if you want them to rot down a bit quicker. Spores can also be a problem: pick them early before the spores have a chance to accumulate to stop them sprouting babies in the compost heap.
I pick buckets of toadstools to put in my many compost bins. I find that they help to break down organic matter much quicker. It acts as an innoculant.