rust
This commit is contained in:
parent
c617ddffc4
commit
56420fd5c5
|
@ -133,7 +133,7 @@ body {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width:600px) {
|
||||
@media (max-width:800px) {
|
||||
#content {
|
||||
grid-template-areas:
|
||||
"header1"
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/css/css.css">
|
||||
<style>
|
||||
.club512 {
|
||||
border-radius: calc(var(--radius)/2);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="background-color: #222;">
|
||||
|
@ -38,13 +43,13 @@
|
|||
<marquee>Footer</marquee>
|
||||
</div>
|
||||
<div class="footer" style="grid-area: footer2; text-align: center">
|
||||
<!-- <a href="https://nixwebr.ing/next/<name>">← prev</a> <a href="https://nixwebr.ing">Nix</a> -->
|
||||
<!-- <a href="https://nixwebr.ing/prev/<name>">next →</a> -->
|
||||
<a href="https://nixwebr.ing/next/<name>">← prev</a> <a href="https://nixwebr.ing">Webring</a>
|
||||
<a href="https://nixwebr.ing/prev/<name>">next →</a>
|
||||
</div>
|
||||
<div class="footer" style="grid-area: footer3; text-align: center;">
|
||||
<!-- <a href="https://512kb.club" style="padding:0"><img style="aspect-ratio: 234.383/30" height=24 -->
|
||||
<!-- alt="a proud member of the green team of 512KB club" -->
|
||||
<!-- src="https://512kb.club/assets/images/green-team.svg"></a> -->
|
||||
<a href="https://512kb.club" style="padding:0"><img style="aspect-ratio: 234.383/30; margin-bottom: -5px" class="club512" height=24
|
||||
alt="a proud member of the green team of 512KB club"
|
||||
src="https://512kb.club/assets/images/green-team.svg"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="background"></div>
|
||||
|
|
|
@ -148,4 +148,50 @@ const maps = {
|
|||
],
|
||||
},
|
||||
|
||||
rust: {
|
||||
rules: [
|
||||
comment("//"),
|
||||
|
||||
string("\""),
|
||||
// single char
|
||||
(peek, take) => {
|
||||
if (peek(0) == "'") {
|
||||
let b = peek(1);
|
||||
take(3);
|
||||
return `<span class="string">'${b}'</span>`;
|
||||
}
|
||||
},
|
||||
|
||||
keyword("fn"),
|
||||
keyword("struct"),
|
||||
keyword("enum"),
|
||||
keyword("trait"),
|
||||
|
||||
keyword("Option"),
|
||||
keyword("Some"),
|
||||
keyword("None"),
|
||||
keyword("Result"),
|
||||
keyword("Ok"),
|
||||
keyword("Err"),
|
||||
keyword("in"),
|
||||
|
||||
altKeyword("if"),
|
||||
altKeyword("else"),
|
||||
altKeyword("match"),
|
||||
altKeyword("loop"),
|
||||
altKeyword("for"),
|
||||
altKeyword("while"),
|
||||
|
||||
altKeyword("mod"),
|
||||
altKeyword("use"),
|
||||
altKeyword("pub"),
|
||||
altKeyword("impl"),
|
||||
altKeyword("crate"),
|
||||
altKeyword("let"),
|
||||
altKeyword("const"),
|
||||
altKeyword("static"),
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -62,6 +62,32 @@ in
|
|||
}
|
||||
```
|
||||
|
||||
```rust
|
||||
// Rust code block
|
||||
fn main() {
|
||||
let x = 40.3;
|
||||
let y = x;
|
||||
|
||||
let g = G { s: vec!["this", "is", "a", "test"] };
|
||||
}
|
||||
|
||||
struct G {
|
||||
pub s: Vec<String>
|
||||
}
|
||||
|
||||
pub trait T {
|
||||
fn some_fn() -> Result<(), String>;
|
||||
}
|
||||
|
||||
impl T for G {
|
||||
fn some_fn() -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
struct
|
||||
|
||||
- List
|
||||
- Test
|
||||
- here
|
||||
|
|
Loading…
Reference in a new issue