Thread (4 messages) 4 messages, 3 authors, 2020-12-13

Re: module as seperate crate

From: Finn Behrens <hidden>
Date: 2020-11-29 18:30:04

Possibly related (same subject, not in this thread)

I create a static mut Mutex<&str> (or similar) to contain the pr_fmt
string. I cannot init the mutex in a const fn, and so I cannot create an
static mut value which already contains a mutex. So I have to call an
init_printk functions which creates this mutex. That's all what I'm doing.

Will try to get something working the following days, and then send a
patch. Mayebe easier to decide then.

Finn

On 11/29/20 7:26 PM, Miguel Ojeda wrote:
On Sun, Nov 29, 2020 at 7:11 PM Finn Behrens [off-list ref] wrote:
quoted
Found a way! proc_macro is just a tokenstream, which gets substituted.
So I can just write what I want there, and it works.

I would start implementing a Mutex<T> type with const and non const
functions now.
I am not sure I understand why you want the Mutex in the module crate
-- the module crate is only used to generate boilerplate code that
needs to go copy-pasted into every module.

Cheers,
Miguel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help