Skip to content

Commit

Permalink
Add SockAddr::set_length
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasdezeeuw committed Apr 11, 2023
1 parent 6e48562 commit c394ac3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sockaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ impl SockAddr {
crate::sys::unix_sockaddr(path.as_ref())
}

/// Set the length of the address.
///
/// # Safety
///
/// Caller must ensure that the address up to `length` bytes are properly
/// initialised.
pub unsafe fn set_length(&mut self, length: socklen_t) {
self.len = length;
}

/// Returns this address's family.
pub const fn family(&self) -> sa_family_t {
self.storage.ss_family
Expand Down

0 comments on commit c394ac3

Please sign in to comment.