network_constants/
ipv4.rs

1// This file is part of network-constants. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/network-constants/master/COPYRIGHT. No part of network-constants, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2016 The developers of network-constants. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/network-constants/master/COPYRIGHT.
3
4
5use std::net::Ipv4Addr;
6
7
8// It would be nice to avoid the cost of constructing this, but it's not allowed in a static...
9#[inline(always)]
10pub fn localhost() -> Ipv4Addr
11{
12	Ipv4Addr::new(127, 0, 0, 1)
13}
14
15#[inline(always)]
16pub fn unspecified() -> Ipv4Addr
17{
18	Ipv4Addr::new(0, 0, 0, 0)
19}
20
21#[inline(always)]
22pub fn broadcast() -> Ipv4Addr
23{
24	Ipv4Addr::new(255, 255, 255, 255)
25}