Skip to content

Commit

Permalink
Add doc aliases for bind, connect, and send_to functions.
Browse files Browse the repository at this point in the history
Functions corresponding to bind, connect, and send_to have different
names in cap-std, so give them doc aliases to make them easier to find
and make the correspondence more clear.
  • Loading branch information
sunfishcode committed Sep 19, 2023
1 parent 4e92198 commit 408ff6c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cap-async-std/src/fs/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixListener::bind`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixListener.html#method.bind
#[doc(alias = "bind")]
#[cfg(unix)]
#[inline]
pub async fn bind_unix_listener<P: AsRef<Path>>(&self, path: P) -> io::Result<UnixListener> {
Expand All @@ -680,6 +681,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixStream::connect`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixStream.html#method.connect
#[doc(alias = "connect")]
#[cfg(unix)]
#[inline]
pub async fn connect_unix_stream<P: AsRef<Path>>(&self, path: P) -> io::Result<UnixStream> {
Expand All @@ -698,6 +700,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixDatagram::bind`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixDatagram.html#method.bind
#[doc(alias = "bind")]
#[cfg(unix)]
#[inline]
pub async fn bind_unix_datagram<P: AsRef<Path>>(&self, path: P) -> io::Result<UnixDatagram> {
Expand All @@ -717,6 +720,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixDatagram::connect`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixDatagram.html#method.connect
#[doc(alias = "connect")]
#[cfg(unix)]
#[inline]
pub async fn connect_unix_datagram<P: AsRef<Path>>(
Expand All @@ -740,6 +744,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixDatagram::send_to`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixDatagram.html#method.send_to
#[doc(alias = "send_to")]
#[cfg(unix)]
#[inline]
pub async fn send_to_unix_datagram_addr<P: AsRef<Path>>(
Expand Down
5 changes: 5 additions & 0 deletions cap-async-std/src/fs_utf8/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixListener::bind`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixListener.html#method.bind
#[doc(alias = "bind")]
#[cfg(unix)]
#[inline]
pub async fn bind_unix_listener<P: AsRef<Utf8Path>>(
Expand All @@ -475,6 +476,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixStream::connect`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixStream.html#method.connect
#[doc(alias = "connect")]
#[cfg(unix)]
#[inline]
pub async fn connect_unix_stream<P: AsRef<Utf8Path>>(&self, path: P) -> io::Result<UnixStream> {
Expand All @@ -490,6 +492,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixDatagram::bind`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixDatagram.html#method.bind
#[doc(alias = "bind")]
#[cfg(unix)]
#[inline]
pub async fn bind_unix_datagram<P: AsRef<Utf8Path>>(
Expand All @@ -509,6 +512,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixDatagram::connect`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixDatagram.html#method.connect
#[doc(alias = "connect")]
#[cfg(unix)]
#[inline]
pub async fn connect_unix_datagram<P: AsRef<Utf8Path>>(
Expand All @@ -531,6 +535,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixDatagram::send_to`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixDatagram.html#method.send_to
#[doc(alias = "send_to")]
#[cfg(unix)]
#[inline]
pub async fn send_to_unix_datagram_addr<P: AsRef<Utf8Path>>(
Expand Down
5 changes: 5 additions & 0 deletions cap-async-std/src/net/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl Pool {
/// address.
///
/// This corresponds to [`async_std::net::TcpListener::bind`].
#[doc(alias = "bind")]
#[inline]
pub async fn bind_tcp_listener<A: ToSocketAddrs>(&self, addr: A) -> io::Result<TcpListener> {
let addrs = addr.to_socket_addrs().await?;
Expand All @@ -127,6 +128,7 @@ impl Pool {
/// Creates a new TCP stream connected to the specified address.
///
/// This corresponds to [`async_std::net::TcpStream::connect`].
#[doc(alias = "connect")]
#[inline]
pub async fn connect_tcp_stream<A: ToSocketAddrs>(&self, addr: A) -> io::Result<TcpStream> {
let addrs = addr.to_socket_addrs().await?;
Expand All @@ -151,6 +153,7 @@ impl Pool {
/// Creates a UDP socket from the given address.
///
/// This corresponds to [`async_std::net::UdpSocket::bind`].
#[doc(alias = "bind")]
#[inline]
pub async fn bind_udp_socket<A: ToSocketAddrs>(&self, addr: A) -> io::Result<UdpSocket> {
let addrs = addr.to_socket_addrs().await?;
Expand All @@ -172,6 +175,7 @@ impl Pool {
/// Sends data on the socket to the given address.
///
/// This corresponds to [`async_std::net::UdpSocket::send_to`].
#[doc(alias = "send_to")]
#[inline]
pub async fn send_to_udp_socket_addr<A: ToSocketAddrs>(
&self,
Expand All @@ -193,6 +197,7 @@ impl Pool {
/// Connects the UDP socket to a remote address.
///
/// This corresponds to [`async_std::net::UdpSocket::connect`].
#[doc(alias = "connect")]
#[inline]
pub async fn connect_udp_socket<A: ToSocketAddrs>(
&self,
Expand Down
5 changes: 5 additions & 0 deletions cap-std/src/fs/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixListener::bind`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.bind
#[doc(alias = "bind")]
#[cfg(unix)]
#[inline]
pub fn bind_unix_listener<P: AsRef<Path>>(&self, path: P) -> io::Result<UnixListener> {
Expand All @@ -496,6 +497,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixStream::connect`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.connect
#[doc(alias = "connect")]
#[cfg(unix)]
#[inline]
pub fn connect_unix_stream<P: AsRef<Path>>(&self, path: P) -> io::Result<UnixStream> {
Expand All @@ -514,6 +516,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixDatagram::bind`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.bind
#[doc(alias = "bind")]
#[cfg(unix)]
#[inline]
pub fn bind_unix_datagram<P: AsRef<Path>>(&self, path: P) -> io::Result<UnixDatagram> {
Expand All @@ -532,6 +535,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixDatagram::connect`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.connect
#[doc(alias = "connect")]
#[cfg(unix)]
#[inline]
pub fn connect_unix_datagram<P: AsRef<Path>>(
Expand All @@ -554,6 +558,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixDatagram::send_to`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.send_to
#[doc(alias = "send_to")]
#[cfg(unix)]
#[inline]
pub fn send_to_unix_datagram_addr<P: AsRef<Path>>(
Expand Down
5 changes: 5 additions & 0 deletions cap-std/src/fs_utf8/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixListener::bind`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixListener.html#method.bind
#[doc(alias = "bind")]
#[cfg(unix)]
#[inline]
pub fn bind_unix_listener<P: AsRef<Utf8Path>>(&self, path: P) -> io::Result<UnixListener> {
Expand All @@ -463,6 +464,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixStream::connect`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixStream.html#method.connect
#[doc(alias = "connect")]
#[cfg(unix)]
#[inline]
pub fn connect_unix_stream<P: AsRef<Utf8Path>>(&self, path: P) -> io::Result<UnixStream> {
Expand All @@ -478,6 +480,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixDatagram::bind`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.bind
#[doc(alias = "bind")]
#[cfg(unix)]
#[inline]
pub fn bind_unix_datagram<P: AsRef<Utf8Path>>(&self, path: P) -> io::Result<UnixDatagram> {
Expand All @@ -493,6 +496,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixDatagram::connect`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.connect
#[doc(alias = "connect")]
#[cfg(unix)]
#[inline]
pub fn connect_unix_datagram<P: AsRef<Utf8Path>>(
Expand All @@ -512,6 +516,7 @@ impl Dir {
/// XXX: This function is not yet implemented.
///
/// [`std::os::unix::net::UnixDatagram::send_to`]: https://doc.rust-lang.org/std/os/unix/net/struct.UnixDatagram.html#method.send_to
#[doc(alias = "send_to")]
#[cfg(unix)]
#[inline]
pub fn send_to_unix_datagram_addr<P: AsRef<Utf8Path>>(
Expand Down
10 changes: 8 additions & 2 deletions cap-std/src/net/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Pool {

/// Add a specific [`net::SocketAddr`] to the pool.
///
/// # AmbientAuthority
/// # Ambient Authority
///
/// This function allows ambient access to any IP address.
pub fn insert_socket_addr(
Expand Down Expand Up @@ -96,7 +96,7 @@ impl Pool {

/// Add a range of network addresses with a specific port to the pool.
///
/// # AmbientAuthority
/// # Ambient Authority
///
/// This function allows ambient access to any IP address.
pub fn insert_ip_net(
Expand All @@ -112,6 +112,7 @@ impl Pool {
/// address.
///
/// This corresponds to [`std::net::TcpListener::bind`].
#[doc(alias = "bind")]
#[inline]
pub fn bind_tcp_listener<A: ToSocketAddrs>(&self, addr: A) -> io::Result<TcpListener> {
let addrs = addr.to_socket_addrs()?;
Expand All @@ -134,6 +135,7 @@ impl Pool {
/// Opens a TCP connection to a remote host.
///
/// This corresponds to [`std::net::TcpStream::connect`].
#[doc(alias = "connect")]
#[inline]
pub fn connect_tcp_stream<A: ToSocketAddrs>(&self, addr: A) -> io::Result<TcpStream> {
let addrs = addr.to_socket_addrs()?;
Expand All @@ -156,6 +158,7 @@ impl Pool {
/// Opens a TCP connection to a remote host with a timeout.
///
/// This corresponds to [`std::net::TcpStream::connect_timeout`].
#[doc(alias = "connect")]
#[inline]
pub fn connect_timeout_tcp_stream(
&self,
Expand All @@ -170,6 +173,7 @@ impl Pool {
/// Creates a UDP socket from the given address.
///
/// This corresponds to [`std::net::UdpSocket::bind`].
#[doc(alias = "bind")]
#[inline]
pub fn bind_udp_socket<A: ToSocketAddrs>(&self, addr: A) -> io::Result<UdpSocket> {
let addrs = addr.to_socket_addrs()?;
Expand All @@ -192,6 +196,7 @@ impl Pool {
/// number of bytes written.
///
/// This corresponds to [`std::net::UdpSocket::send_to`].
#[doc(alias = "send_to")]
#[inline]
pub fn send_to_udp_socket_addr<A: ToSocketAddrs>(
&self,
Expand All @@ -212,6 +217,7 @@ impl Pool {
/// only receive data from the specified address.
///
/// This corresponds to [`std::net::UdpSocket::connect`].
#[doc(alias = "connect")]
#[inline]
pub fn connect_udp_socket<A: ToSocketAddrs>(
&self,
Expand Down

0 comments on commit 408ff6c

Please sign in to comment.