Leyline of the Void has a replacement effect that reads: 'If a card would be put into an opponent's graveyard from anywhere, exile it instead.' This effect applies to cards going to the graveyard from anywhere, which explicitly includes the library (CR 614.1a, 614.6).
Milling is defined by CR 701.13 as putting cards from the top of a library into their owner's graveyard. Because those cards would normally move to the graveyard, Leyline of the Void's replacement effect intercepts that event and sends them to exile instead, before they ever reach the graveyard.
This replacement effect is applied by the controller of Leyline of the Void whenever the affected event would occur (CR 616.1). Because it replaces the destination entirely, graveyard-based triggers such as 'whenever a card is put into a graveyard from a library' will not trigger for those cards, since they never touched the graveyard.
Example: Your opponent controls Leyline of the Void. You cast Glimpse the Unthinkable, which mills you for 10. All 10 cards are exiled instead of going to your graveyard because of Leyline's replacement effect.
Note that Leyline of the Void only affects opponents' cards from the perspective of its controller. A player who controls the Leyline is not affected by it themselves (CR 614.6).
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.