上一页 1 ··· 53 54 55 56 57 58 59 60 61 ··· 499 下一页
摘要: 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 阅读(27) 评论(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 阅读(39) 评论(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 阅读(38) 评论(0) 推荐(0)
摘要: The TryFrom and try_into() methods are part of the. standard libaray's conversion traits, designed to handle conversions between types in a fallible m 阅读全文
posted @ 2024-02-26 14:54 Zhentiw 阅读(48) 评论(0) 推荐(0)
摘要: https://doc.rust-lang.org/std/string/struct.String.html#method.trim fn string_slice(arg: &str) { println!("{}", arg); } fn string(arg: String) { print 阅读全文
posted @ 2024-02-26 03:15 Zhentiw 阅读(34) 评论(0) 推荐(0)
摘要: Structs contain data, but can also have logic. In this exercise we have defined the Package struct and we want to test some logic attached to it. #[de 阅读全文
posted @ 2024-02-26 02:51 Zhentiw 阅读(44) 评论(0) 推荐(0)
摘要: https://doc.rust-lang.org/stable/book/ch05-01-defining-structs.html#creating-instances-from-other-instances-with-struct-update-syntax Similar to Javas 阅读全文
posted @ 2024-02-26 02:44 Zhentiw 阅读(35) 评论(0) 推荐(0)
摘要: fn multiply(x: i64, y: u8) -> i64 { return x * (y as i64); } Here we convert u8to i64, which is possible since i64has a wider range than u8; but you c 阅读全文
posted @ 2024-02-24 19:01 Zhentiw 阅读(32) 评论(0) 推荐(0)
摘要: https://doc.rust-lang.org/book/ch05-01-defining-structs.html struct ColorClassicStruct { red: i32, green: i32, blue: i32 } struct ColorTupleStruct(i32 阅读全文
posted @ 2024-02-23 19:11 Zhentiw 阅读(36) 评论(0) 推荐(0)
摘要: fn main() { let cat = ("Furry McFurson", 3.5); let (name, age) = cat; println!("{} is {} years old.", name, age); } Example 2: #[test] fn indexing_tup 阅读全文
posted @ 2024-02-23 19:04 Zhentiw 阅读(35) 评论(0) 推荐(0)
上一页 1 ··· 53 54 55 56 57 58 59 60 61 ··· 499 下一页