diff --git a/CHANGELOG.md b/CHANGELOG.md index a8a1f256..90446ce5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -466,7 +466,7 @@ This release was broken for Windows. * `Protocol::tcp` => `Protocol::TCP`. * `Protocol::udp` => `Protocol::UDP`. * **BREAKING:** Changed the signature of `Socket::recv`, `Socket::recv_vectored` - and related methods to accept unitialised buffers. The `Read` implementation + and related methods to accept uninitialised buffers. The `Read` implementation can be used to read into initialised buffers. * **BREAKING:** Renamed `SockAddr::as_std` to `as_socket`. * **BREAKING:** Renamed `SockAddr::as_inet` to `as_socket_ipv4`. diff --git a/src/sockaddr.rs b/src/sockaddr.rs index 788ae615..cec97b65 100644 --- a/src/sockaddr.rs +++ b/src/sockaddr.rs @@ -249,7 +249,7 @@ impl SockAddr { &self.storage as *const sockaddr_storage as *const SockAddrStorage } - /// Retuns the address as the storage. + /// Returns the address as the storage. pub const fn as_storage(self) -> SockAddrStorage { SockAddrStorage { storage: self.storage, @@ -326,7 +326,7 @@ impl SockAddr { /// Returns the initialised storage bytes. fn as_bytes(&self) -> &[u8] { // SAFETY: `self.storage` is a C struct which can always be treated a - // slice of bytes. Furthermore, we ensure we don't read any unitialised + // slice of bytes. Furthermore, we ensure we don't read any uninitialised // bytes by using `self.len`. unsafe { std::slice::from_raw_parts(self.as_ptr().cast(), self.len as usize) } } diff --git a/src/socket.rs b/src/socket.rs index 22fe858b..b6cbcdb0 100644 --- a/src/socket.rs +++ b/src/socket.rs @@ -493,7 +493,7 @@ impl Socket { sys::recv_vectored(self.as_raw(), bufs, flags) } - /// Receives data on the socket from the remote adress to which it is + /// Receives data on the socket from the remote address to which it is /// connected, without removing that data from the queue. On success, /// returns the number of bytes peeked. /// @@ -2254,7 +2254,7 @@ impl Read for Socket { fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result { // Safety: both `IoSliceMut` and `MaybeUninitSlice` promise to have the // same layout, that of `iovec`/`WSABUF`. Furthermore, `recv_vectored` - // promises to not write unitialised bytes to the `bufs` and pass it + // promises to not write uninitialised bytes to the `bufs` and pass it // directly to the `recvmsg` system call, so this is safe. let bufs = unsafe { &mut *(bufs as *mut [IoSliceMut<'_>] as *mut [MaybeUninitSlice<'_>]) }; self.recv_vectored(bufs).map(|(n, _)| n) diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 28a06ddc..3a60ada3 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -780,7 +780,7 @@ impl SockAddr { .unwrap_or_default() } - /// Returns the underlying `sockaddr_un` object if this addres is from the `AF_UNIX` family, + /// Returns the underlying `sockaddr_un` object if this address is from the `AF_UNIX` family, /// otherwise returns `None`. pub(crate) fn as_sockaddr_un(&self) -> Option<&libc::sockaddr_un> { self.is_unix().then(|| { diff --git a/tests/socket.rs b/tests/socket.rs index 133fab27..3c263646 100644 --- a/tests/socket.rs +++ b/tests/socket.rs @@ -1871,7 +1871,7 @@ fn set_priority() { let socket = Socket::new(Domain::UNIX, Type::DGRAM, None).unwrap(); assert!(socket.priority().unwrap() == 0); - // test priorities 6 .. 0; values above 6 require additional priviledges + // test priorities 6 .. 0; values above 6 require additional privileges for i in (0..=6).rev() { socket.set_priority(i).unwrap(); assert!(socket.priority().unwrap() == i); @@ -1884,7 +1884,7 @@ fn set_busy_poll() { let socket = Socket::new(Domain::UNIX, Type::DGRAM, None).unwrap(); assert!(socket.busy_poll().unwrap() == 0); - // test busy poll values 0 .. 6; values above 6 require additional priviledges + // test busy poll values 0 .. 6; values above 6 require additional privileges for i in (0..=6).rev() { socket.set_busy_poll(i).unwrap(); assert!(socket.busy_poll().unwrap() == i);