Skip to content

Commit c7be625

Browse files
committed
Mark some SockAddr methods const
1 parent 163a378 commit c7be625

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sockaddr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,23 @@ impl SockAddr {
6363
}
6464

6565
/// Returns this address's family.
66-
pub fn family(&self) -> sa_family_t {
66+
pub const fn family(&self) -> sa_family_t {
6767
self.storage.ss_family
6868
}
6969

7070
/// Returns the size of this address in bytes.
71-
pub fn len(&self) -> socklen_t {
71+
pub const fn len(&self) -> socklen_t {
7272
self.len
7373
}
7474

7575
/// Returns a raw pointer to the address.
76-
pub fn as_ptr(&self) -> *const sockaddr {
76+
pub const fn as_ptr(&self) -> *const sockaddr {
7777
&self.storage as *const _ as *const _
7878
}
7979

8080
/// Returns a raw pointer to the address storage.
8181
#[cfg(unix)]
82-
pub(crate) fn as_storage_ptr(&self) -> *const sockaddr_storage {
82+
pub(crate) const fn as_storage_ptr(&self) -> *const sockaddr_storage {
8383
&self.storage
8484
}
8585

0 commit comments

Comments
 (0)