async haxx (public Priority)

This commit is contained in:
Per Lindgren 2020-10-19 21:00:18 +02:00
parent 6de4f1a797
commit 41472032dc
3 changed files with 7 additions and 2 deletions

View file

@ -56,7 +56,8 @@ pub fn codegen(
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#(#cfgs)* #(#cfgs)*
pub struct #name<'a> { pub struct #name<'a> {
priority: &'a Priority, // PER: this is unsound
pub priority: &'a Priority,
} }
#(#cfgs)* #(#cfgs)*

View file

@ -165,6 +165,7 @@ pub fn codegen(
let constructor = quote!( let constructor = quote!(
impl<#lt> #ident<#lt> { impl<#lt> #ident<#lt> {
#[inline(always)] #[inline(always)]
// pub const unsafe fn new(#arg) -> Self {
pub unsafe fn new(#arg) -> Self { pub unsafe fn new(#arg) -> Self {
#ident { #ident {
#(#values,)* #(#values,)*

View file

@ -78,7 +78,7 @@ impl Priority {
/// ///
/// Will overwrite the current Priority /// Will overwrite the current Priority
#[inline(always)] #[inline(always)]
pub unsafe fn new(value: u8) -> Self { pub const unsafe fn new(value: u8) -> Self {
Priority { Priority {
inner: Cell::new(value), inner: Cell::new(value),
} }
@ -98,6 +98,9 @@ impl Priority {
} }
} }
// PER: not sure if this is a problem
unsafe impl Sync for Priority {}
#[inline(always)] #[inline(always)]
pub fn assert_send<T>() pub fn assert_send<T>()
where where