On Linux, blkdiscard can be used in the same manner (create a dummy partition and run blkdiscard on it ex. *blkdiscard /dev/sda2).
It depends on 'issue_discards' being set in the config
This has drifted over time. I haven't quite rationalized why. Hoping someone can remind me if nothing else, away from a real computer for a bit.
Apparently macOS doesn't expose the ability for userspace to manually issue trim commands to block devices (or at least doesn't ship a suitable tool to do so), so the best available workaround is to tell the filesystem layer that it should do automatic trimming even on external drives.
[1]: https://man7.org/linux/man-pages/man8/blkdiscard.8.html / https://github.com/util-linux/util-linux/blob/master/sys-uti...
But you’re most probably doing this on a device with nothing valuable on it, so you should be able to just trim the whole thing and then allocate and format whatever piece of it that you are planning to use.