There are probably faster ways, but none that I could think of a the time.
For future reference, `nmap -p22 --open 192.168.1.*` does everything your rust script currently does.
Nmap is THE tool for the job of network scans. IMO, it should be in the toolbelt of every techie that deals with any sort of computer network.
Other quick ways besides the mentioned nmap: ping the broadcast address (if ICMP is allowed) or install avahi-daemon and you can just refer to "your-machines-hostname.local"
There are probably faster ways, but none that I could think of a the time.