Skip to content
Open
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ version = "0.2"
optional = true

[target.'cfg(windows)'.dependencies.windows]
version = "0.43"
version = "0.54.0"
optional = true
features = [
"Win32_System_Diagnostics_ToolHelp",
Expand Down
3 changes: 3 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ impl MfError {

#[cfg(all(unix, feature = "std"))]
pub(crate) fn last<T>() -> Result<T> {
#[cfg(target_os = "linux")]
unsafe { Err(MfError::Errno(*libc::__errno_location())) }
#[cfg(target_os = "macos")]
unsafe { Err(MfError::Errno(*libc::__error())) }
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/internal/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ pub fn modules() -> impl Iterator<Item = crate::types::ModuleInfoWithName> {

/// Allocates new console.
pub fn alloc_console() -> bool {
unsafe { AllocConsole().as_bool() }
unsafe { AllocConsole().is_ok() }
}

/// Frees the console.
pub fn free_console() -> bool {
unsafe { FreeConsole().as_bool() }
unsafe { FreeConsole().is_ok() }
}

/// Frees the library and exits current thread.
Expand Down
4 changes: 2 additions & 2 deletions src/types/win/linked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl<const OFFSET: usize, T> ListEntry<OFFSET, T> {
}

/// Assuming `self` is a list head, iterate over immutable references to all items in the list.
pub unsafe fn iter<'r>(&self) -> impl Iterator<Item = &'r T> {
pub unsafe fn iter<'r>(&self) -> impl Iterator<Item = &'r T> where T: 'r {
let last = self.prev.map(|v| v.as_ptr().cast_const());
let mut current = last;
core::iter::from_fn(move || unsafe {
Expand All @@ -60,7 +60,7 @@ impl<const OFFSET: usize, T> ListEntry<OFFSET, T> {
}

/// Assuming `self` is a list head, iterate over mutable references to all items in the list.
pub unsafe fn iter_mut<'r>(&mut self) -> impl Iterator<Item = &'r mut T> {
pub unsafe fn iter_mut<'r>(&mut self) -> impl Iterator<Item = &'r mut T> where T: 'r {
let last = self.prev.map(|v| v.as_ptr());
let mut current = last;
core::iter::from_fn(move || unsafe {
Expand Down