上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 494 下一页
摘要: pub fn generate_nametag_text(name: String) -> Result<String, String> { if name.is_empty() { // Empty names aren't allowed. Err(String::from("`name` wa 阅读全文
posted @ 2024-03-01 15:49 Zhentiw 阅读(37) 评论(0) 推荐(0)
摘要: function logThis() { console.log(this) } const obj = { logThis, logThis2() { logThis() }, logThis3() { obj.logThis() } } obj.logThis(); obj.logThis2() 阅读全文
posted @ 2024-02-29 22:11 Zhentiw 阅读(15) 评论(0) 推荐(0)
摘要: Here is how typescript does the same thing export type Data = { projector: { //pwd [key: string]: { // key -> value [key: string]: string, } } } Here 阅读全文
posted @ 2024-02-29 19:54 Zhentiw 阅读(11) 评论(0) 推荐(0)
摘要: Following code has compile error: #[test] fn main() { let vec0 = vec![22, 44, 66]; let mut vec1 = fill_vec(vec0); assert_eq!(vec1, vec![22, 44, 66, 88 阅读全文
posted @ 2024-02-27 15:37 Zhentiw 阅读(23) 评论(0) 推荐(0)
摘要: Following code has borrow problem: #[test] fn main() { let vec0 = vec![22, 44, 66]; let vec1 = fill_vec(vec0); assert_eq!(vec0, vec![22, 44, 66]); ass 阅读全文
posted @ 2024-02-27 15:33 Zhentiw 阅读(29) 评论(0) 推荐(0)
摘要: Define a macro and use it: macro_rules! my_macro { () => { println!("Check out my macro!"); }; } fn main() { my_macro!(); } Notice that you have time 阅读全文
posted @ 2024-02-27 15:23 Zhentiw 阅读(16) 评论(0) 推荐(0)
摘要: Methods: mod sausage_factory { // private method fn get_secret_recipe() -> String { String::from("Ginger") } // public method pub fn make_sausage() { 阅读全文
posted @ 2024-02-27 14:51 Zhentiw 阅读(17) 评论(0) 推荐(0)
摘要: enum Message { ChangeColor(u8, u8, u8), Echo(String), Move(Point), Quit, } struct Point { x: u8, y: u8, } struct State { color: (u8, u8, u8), position 阅读全文
posted @ 2024-02-26 23:44 Zhentiw 阅读(12) 评论(0) 推荐(0)
摘要: Web API, such as setTimeout setInterval which goes into Macrotask Queue; Microtask such as, code after await, Promise, all go to Microtask Queue direc 阅读全文
posted @ 2024-02-26 16:03 Zhentiw 阅读(16) 评论(0) 推荐(0)
摘要: Code: config.go package projector import ( "fmt" "os" "path" ) type Operation = int const ( Print Operation = iota Add Remove ) type Config struct { A 阅读全文
posted @ 2024-02-26 15:47 Zhentiw 阅读(16) 评论(0) 推荐(0)
上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 494 下一页