Skip to content

Commit 21f8637

Browse files
committed
Fix issue with jekyll f**king up my codeblocks
1 parent 1a8a044 commit 21f8637

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

org/_posts/2024-09-13-rust_simple_declarative_macros.org

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ In the C macros above, I said that a major flaw was that they didn't allow proce
221221

222222
To make our =deduped_vec= macro interesting, we will allow for optional commas between elements. How would such a code look?
223223

224+
{% raw %}
224225
#+BEGIN_SRC rust
225226
macro_rules! deduped_vec {
226227
// single element to show that we can have several rules!
@@ -255,6 +256,7 @@ To make our =deduped_vec= macro interesting, we will allow for optional commas b
255256
// prints:
256257
// Our deduped vec: [1, 2, 3]
257258
#+END_SRC
259+
{% endraw %}
258260

259261
You will notice that we can have several possible match patterns in a macro! Pretty neat! We don't need to dedup or sort if we only have one element.
260262

@@ -279,6 +281,7 @@ Let us first start with how we want to use our macro:
279281

280282
Looks awful, but we want to show a point here. Like in the last example, we understand that we need to return a block (so the variables go out of scope after the block is executed if they are not returned from the block). For some of you, this may be straight forward, but you can actually use text directly in your patterns. A possible implementation will look like:
281283

284+
{% raw %}
282285
#+BEGIN_SRC rust
283286
macro_rules! define_scope {
284287
(($($name:ident is defined to be $result:expr)*) $do:block) => {{
@@ -289,6 +292,7 @@ Looks awful, but we want to show a point here. Like in the last example, we unde
289292
}};
290293
}
291294
#+END_SRC
295+
{% endraw %}
292296

293297
That actually took very little code! Even if the generated Rust code is less verbose, we proved that you can make the syntax you have always dreamed of (if you are insane)! With great power, comes great responsibility.
294298

0 commit comments

Comments
 (0)