From 99bba8834959dcf47237c6b0d1980a9cd3714d02 Mon Sep 17 00:00:00 2001 From: Alex Franchuk Date: Mon, 16 Sep 2024 09:31:13 -0400 Subject: [PATCH] Use NonZeroUsize rather than generic NonZero, which is a fairly recent addition. --- src/linux/mem_reader.rs | 4 ++-- src/linux/module_reader.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/linux/mem_reader.rs b/src/linux/mem_reader.rs index 1e9fc87e..e4a50411 100644 --- a/src/linux/mem_reader.rs +++ b/src/linux/mem_reader.rs @@ -97,7 +97,7 @@ impl MemReader { pub fn read_to_vec( &mut self, src: usize, - length: std::num::NonZero, + length: std::num::NonZeroUsize, ) -> Result, CopyFromProcessError> { let length = length.into(); let layout = @@ -258,7 +258,7 @@ impl PtraceDumper { src: usize, length: usize, ) -> Result, crate::errors::DumperError> { - let length = std::num::NonZero::new(length).ok_or_else(|| { + let length = std::num::NonZeroUsize::new(length).ok_or_else(|| { crate::errors::DumperError::CopyFromProcessError(CopyFromProcessError { src, child: pid, diff --git a/src/linux/module_reader.rs b/src/linux/module_reader.rs index 08ee8189..f40e28cc 100644 --- a/src/linux/module_reader.rs +++ b/src/linux/module_reader.rs @@ -55,7 +55,7 @@ impl<'buf> ProcessMemory<'buf> { match self { Self::Process(pr) => { let error = |e| error(Some(pr.start_address), e); - let len = std::num::NonZero::new(length as usize) + let len = std::num::NonZeroUsize::new(length as usize) .ok_or_else(|| error(nix::Error::EINVAL))?; let proc_offset = pr .start_address