Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions src/sockaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) }
}
Expand Down
4 changes: 2 additions & 2 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -2254,7 +2254,7 @@ impl Read for Socket {
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
// 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)
Expand Down
2 changes: 1 addition & 1 deletion src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(|| {
Expand Down
4 changes: 2 additions & 2 deletions tests/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down