rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Finn Behrens <me@kloenk.de>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: rust-for-linux@vger.kernel.org
Subject: Re: module as seperate crate
Date: Sun, 29 Nov 2020 19:30:04 +0100	[thread overview]
Message-ID: <6c621482-94c7-b34b-6d46-5036df3fc1ff@kloenk.de> (raw)
In-Reply-To: <CANiq72negqN+2eOjieYW1Zas1ays3t3W-+wZisXjF9q=kob3yw@mail.gmail.com>

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 <me@kloenk.de> wrote:
>> 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

  parent reply	other threads:[~2020-11-29 18:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-29 17:36 module as seperate crate Finn Behrens
2020-11-29 17:51 ` Miguel Ojeda
2020-11-29 17:54   ` Finn Behrens
     [not found]     ` <d417fec0-c5c6-edda-796e-a861f5518eed@kloenk.de>
     [not found]       ` <CANiq72negqN+2eOjieYW1Zas1ays3t3W-+wZisXjF9q=kob3yw@mail.gmail.com>
2020-11-29 18:30         ` Finn Behrens [this message]
2020-12-09 23:20           ` Miguel Ojeda
2020-12-12 23:48             ` Wedson Almeida Filho
2020-12-13  1:00               ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c621482-94c7-b34b-6d46-5036df3fc1ff@kloenk.de \
    --to=me@kloenk.de \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).