Skip to content

Commit c394ac3

Browse files
committed
Add SockAddr::set_length
1 parent 6e48562 commit c394ac3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/sockaddr.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@ impl SockAddr {
153153
crate::sys::unix_sockaddr(path.as_ref())
154154
}
155155

156+
/// Set the length of the address.
157+
///
158+
/// # Safety
159+
///
160+
/// Caller must ensure that the address up to `length` bytes are properly
161+
/// initialised.
162+
pub unsafe fn set_length(&mut self, length: socklen_t) {
163+
self.len = length;
164+
}
165+
156166
/// Returns this address's family.
157167
pub const fn family(&self) -> sa_family_t {
158168
self.storage.ss_family

0 commit comments

Comments
 (0)