Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update rust crate zerocopy to 0.8.0 #15

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ license = "MIT"

[dependencies]
libc = "0.2.155"
utmp-raw = { git = "https://github.com/Unpublished/utmp-rs" }
utmp-raw = { git = "https://github.com/Unpublished/utmp-rs", branch = "dev" }
thiserror = "2.0.0"
zerocopy = "0.7.35"
zerocopy = "0.8.0"

[dev-dependencies]
anyhow = "1.0.86"
Expand Down
6 changes: 3 additions & 3 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::mem;
use std::path::Path;
use thiserror::Error;
use utmp_raw::{utmp, x32::utmp as utmp32, x64::utmp as utmp64};
use zerocopy::{FromBytes, Ref};
use zerocopy::{FromBytes, Immutable, KnownLayout};

#[doc(hidden)]
pub struct UtmpParserImpl<R, T = utmp>(R, PhantomData<T>);
Expand Down Expand Up @@ -86,7 +86,7 @@ impl<R: Read> Iterator for UtmpParserImpl<R, utmp64> {
}
}

fn read_entry<R: Read, T: FromBytes>(
fn read_entry<R: Read, T: FromBytes + Immutable + KnownLayout>(
mut reader: R,
buffer: &mut [u8],
) -> Result<Option<&T>, ParseError> {
Expand All @@ -111,7 +111,7 @@ fn read_entry<R: Read, T: FromBytes>(
Err(e) => return Err(e.into()),
}
}
Ok(Some(Ref::<_, T>::new(buffer).unwrap().into_ref()))
Ok(Some(T::ref_from_bytes(buffer).unwrap()))
}

/// Parse utmp entries.
Expand Down
Loading