Skip to content

Commit

Permalink
Move SocketAddrStorage to crate::net::addr
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmehall committed Feb 2, 2025
1 parent 2a27e6d commit 28a1f52
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/backend/libc/net/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ use crate::net::Protocol;
target_env = "newlib"
))]
use crate::net::RawProtocol;
use crate::net::{Ipv4Addr, Ipv6Addr, SocketType};
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
use crate::net::{SocketAddrAny, SocketAddrStorage, SocketAddrV4};
use crate::net::{addr::SocketAddrStorage, SocketAddrAny, SocketAddrV4};
use crate::net::{Ipv4Addr, Ipv6Addr, SocketType};
#[cfg(linux_kernel)]
use crate::net::{SocketAddrV6, UCred};
use crate::utils::as_mut_ptr;
Expand Down
4 changes: 2 additions & 2 deletions src/backend/linux_raw/net/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use crate::net::sockopt::Timeout;
#[cfg(target_os = "linux")]
use crate::net::xdp::{XdpMmapOffsets, XdpOptionsFlags, XdpRingOffset, XdpStatistics, XdpUmemReg};
use crate::net::{
AddressFamily, Ipv4Addr, Ipv6Addr, Protocol, RawProtocol, SocketAddrAny, SocketAddrStorage,
SocketAddrV4, SocketAddrV6, SocketType, UCred,
addr::SocketAddrStorage, AddressFamily, Ipv4Addr, Ipv6Addr, Protocol, RawProtocol,
SocketAddrAny, SocketAddrV4, SocketAddrV6, SocketType, UCred,
};
#[cfg(feature = "alloc")]
use alloc::borrow::ToOwned;
Expand Down
2 changes: 2 additions & 0 deletions src/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use crate::backend::net::write_sockaddr::{encode_sockaddr_v4, encode_sockaddr_v6

use super::{SocketAddr, SocketAddrV4, SocketAddrV6};

pub use crate::backend::net::addr::SocketAddrStorage;

#[cfg(unix)]
use super::SocketAddrUnix;

Expand Down
2 changes: 1 addition & 1 deletion src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub use crate::maybe_polyfill::net::{
};
pub use send_recv::*;
pub use socket::*;
pub use socket_addr_any::{SocketAddrAny, SocketAddrStorage};
pub use socket_addr_any::SocketAddrAny;
#[cfg(not(any(windows, target_os = "wasi")))]
pub use socketpair::socketpair;
pub use types::*;
Expand Down
4 changes: 1 addition & 3 deletions src/net/socket_addr_any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ use crate::net::xdp::SocketAddrXdp;
#[cfg(unix)]
use crate::net::SocketAddrUnix;
use crate::net::{
addr::{SocketAddrArg, SocketAddrOpaque},
addr::{SocketAddrArg, SocketAddrOpaque, SocketAddrStorage},
AddressFamily, SocketAddr, SocketAddrV4, SocketAddrV6,
};
use crate::{backend, io};
#[cfg(feature = "std")]
use core::fmt;
use core::ptr::copy_nonoverlapping;

pub use backend::net::addr::SocketAddrStorage;

/// `struct sockaddr_storage` as a Rust enum.
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
#[doc(alias = "sockaddr")]
Expand Down
2 changes: 1 addition & 1 deletion src/net/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,7 @@ fn test_sizes() {
#[cfg(target_os = "linux")]
use crate::backend::c;
use crate::ffi::c_int;
use crate::net::SocketAddrStorage;
use crate::net::addr::SocketAddrStorage;
use core::mem::transmute;

// Backend code needs to cast these to `c_int` so make sure that cast isn't
Expand Down
2 changes: 1 addition & 1 deletion tests/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn encode_decode() {
#[cfg(unix)]
use rustix::net::SocketAddrUnix;
use rustix::net::{
Ipv4Addr, Ipv6Addr, SocketAddrAny, SocketAddrStorage, SocketAddrV4, SocketAddrV6,
addr::SocketAddrStorage, Ipv4Addr, Ipv6Addr, SocketAddrAny, SocketAddrV4, SocketAddrV6,
};

unsafe {
Expand Down

0 comments on commit 28a1f52

Please sign in to comment.