Re: [PATCH v7 2/6] rust: implement `Class` for ww_class support

From: Onur Özkan

Date: Thu Nov 27 2025 - 04:05:29 EST


On Fri, 21 Nov 2025 14:15:00 -0500
Lyude Paul <lyude@xxxxxxxxxx> wrote:

> This should be is_wait_die.into() like you did in the code below.

Can't call into() in const function.

> With that:
>
> Reviewed-by: Lyude Paul <lyude@xxxxxxxxxx>
>
> On Sat, 2025-11-01 at 19:10 +0300, Onur Özkan wrote:
> > +impl Class {
> > +    /// Creates an unpinned [`Class`].
> > +    ///
> > +    /// # Safety
> > +    ///
> > +    /// Caller must guarantee that the returned value is not moved
> > after creation.
> > +    pub const unsafe fn unpinned_new(name: &'static CStr,
> > is_wait_die: bool) -> Self {
> > +        Class {
> > +            inner: Opaque::new(bindings::ww_class {
> > +                stamp: bindings::atomic_long_t { counter: 0 },
> > +                acquire_name: name.as_char_ptr(),
> > +                mutex_name: name.as_char_ptr(),
> > +                is_wait_die: is_wait_die as u32,
>

-Onur