This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import asyncio | |
async def waiter(event): | |
print('waiting for it ...') | |
await event.wait() | |
print('... got it!') | |
async def main(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Elem(u32); | |
struct Slotmap { | |
data: Vec<Elem>, | |
} | |
impl Slotmap { | |
fn get(&self) -> &Elem { | |
&self.data[0] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
fn test1() { | |
let mut m = HashMap::new(); | |
m.insert(1, "hello"); | |
m.insert(2, "world"); | |
let r1 = m.get(&1).unwrap(); | |
let r2 = m.get_mut(&2).unwrap(); | |
println!("1 : {:?}", r1); | |
println!("2 : {:?}", r2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClassA: | |
x = 10 | |
class MyClassB: | |
def __init__(self): | |
self.x = 10 |