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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
code at that point.
- Make the `[try_][pin_]init!` macros expose initialized fields via a `let`
binding as `&mut T` or `Pin<&mut T>` for later fields.
- `derive([Maybe]Zeroable)` now support tuple structs

## [0.0.10] - 2025-08-19

Expand Down
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ struct DriverData {

impl DriverData {
fn new() -> impl PinInit<Self, Error> {
try_pin_init!(Self {
pin_init!(Self {
status <- CMutex::new(0),
buffer: Box::init(pin_init::init_zeroed())?,
}? Error)
Expand Down
19 changes: 9 additions & 10 deletions examples/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use core::{
cell::Cell,
convert::Infallible,
marker::PhantomPinned,
pin::Pin,
ptr::{self, NonNull},
Expand All @@ -31,31 +30,31 @@ pub struct ListHead {

impl ListHead {
#[inline]
pub fn new() -> impl PinInit<Self, Infallible> {
try_pin_init!(&this in Self {
pub fn new() -> impl PinInit<Self> {
pin_init!(&this in Self {
next: unsafe { Link::new_unchecked(this) },
prev: unsafe { Link::new_unchecked(this) },
pin: PhantomPinned,
}? Infallible)
})
}

#[inline]
#[allow(dead_code)]
pub fn insert_next(list: &ListHead) -> impl PinInit<Self, Infallible> + '_ {
try_pin_init!(&this in Self {
pub fn insert_next(list: &ListHead) -> impl PinInit<Self> + '_ {
pin_init!(&this in Self {
prev: list.next.prev().replace(unsafe { Link::new_unchecked(this)}),
next: list.next.replace(unsafe { Link::new_unchecked(this)}),
pin: PhantomPinned,
}? Infallible)
})
}

#[inline]
pub fn insert_prev(list: &ListHead) -> impl PinInit<Self, Infallible> + '_ {
try_pin_init!(&this in Self {
pub fn insert_prev(list: &ListHead) -> impl PinInit<Self> + '_ {
pin_init!(&this in Self {
next: list.prev.next().replace(unsafe { Link::new_unchecked(this)}),
prev: list.prev.replace(unsafe { Link::new_unchecked(this)}),
pin: PhantomPinned,
}? Infallible)
})
}

#[inline]
Expand Down
10 changes: 5 additions & 5 deletions examples/pthread_mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ mod pthread_mtx {
// SAFETY: mutex has been initialized
unsafe { pin_init_from_closure(init) }
}
try_pin_init!(Self {
data: UnsafeCell::new(data),
raw <- init_raw(),
pin: PhantomPinned,
}? Error)
pin_init!(Self {
data: UnsafeCell::new(data),
raw <- init_raw(),
pin: PhantomPinned,
}? Error)
}

#[allow(dead_code)]
Expand Down
16 changes: 14 additions & 2 deletions internal/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ proc-macro = true
[dependencies]
quote = "1.0"
proc-macro2 = "1.0"
syn = { version = "2.0.86", features = ["full", "parsing", "visit-mut"] }

[build-dependencies]
rustc_version = "0.4"
Expand Down
152 changes: 0 additions & 152 deletions internal/src/helpers.rs

This file was deleted.

Loading
Loading