From 97b5b3494beb1d6a45b86ff55485864d4eabb7df Mon Sep 17 00:00:00 2001 From: Gleb Pomykalov <gleb@lancastr.com> Date: Mon, 18 Feb 2019 22:35:42 +0300 Subject: [PATCH] improve naming --- src/unix/notbsd/android/mod.rs | 8 ++++---- src/unix/notbsd/linux/mod.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 88a1af96..089780f5 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -508,14 +508,14 @@ cfg_if! { } impl af_alg_iv { - unsafe fn iv(&self) -> &[u8] { + unsafe fn as_slice(&self) -> &[u8] { ::std::slice::from_raw_parts(self.iv.as_ptr(), self.ivlen as usize) } } impl PartialEq for af_alg_iv { fn eq(&self, other: &af_alg_iv) -> bool { - *self.iv() == *other.iv() + *self.as_slice() == *other.as_slice() } } @@ -524,14 +524,14 @@ cfg_if! { impl ::fmt::Debug for af_alg_iv { fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { f.debug_struct("af_alg_iv") - .field("iv", self.iv()) + .field("iv", self.as_slice()) .finish() } } impl ::hash::Hash for af_alg_iv { fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.iv().hash(state); + self.as_slice().hash(state); } } } diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index c41e1a02..df0cce7b 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -727,14 +727,14 @@ cfg_if! { } impl af_alg_iv { - unsafe fn iv(&self) -> &[u8] { + unsafe fn as_slice(&self) -> &[u8] { ::std::slice::from_raw_parts(self.iv.as_ptr(), self.ivlen as usize) } } impl PartialEq for af_alg_iv { fn eq(&self, other: &af_alg_iv) -> bool { - *self.iv() == *other.iv() + *self.as_slice() == *other.as_slice() } } @@ -743,14 +743,14 @@ cfg_if! { impl ::fmt::Debug for af_alg_iv { fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { f.debug_struct("af_alg_iv") - .field("iv", self.iv()) + .field("iv", self.as_slice()) .finish() } } impl ::hash::Hash for af_alg_iv { fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.iv().hash(state); + self.as_slice().hash(state); } } } -- GitLab