上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 464 下一页
摘要: struct VecMetadata { first_elem_index: usize, length: usize, capacity: usize } struct SliceMetadata { first_elem_index: usize, length: usize } Slice i 阅读全文
posted @ 2024-04-08 14:20 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要: The following code will have borrowing problem fn print_years(years: Vec<i32>) { for year in years.iter() { println!("Year: {}", year); } } // dealloc 阅读全文
posted @ 2024-04-08 01:24 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要: function freeze(config?: { unless: () => boolean }) { return function(target: any, propertyKey: string) { let value: any; const getter = function () { 阅读全文
posted @ 2024-04-07 17:14 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要: Mutate the Vec: fn vec_loop(mut v: Vec<i32>) -> Vec<i32> { for element in v.iter_mut() { // Fill this up so that each element in the Vec `v` is // mul 阅读全文
posted @ 2024-04-03 02:20 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要: Intro to Array.prototype.with(index, value) const ages = [10, 15, 20, 25]; const newAges = ages.with(1, 16); console.log(newAges); // [10, 16, 20, 25] 阅读全文
posted @ 2024-03-26 15:28 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要: Example 1: trait AppendBar { fn append_bar(self) -> Self; } impl AppendBar for String { fn append_bar(mut self) -> Self { self.push_str("Bar"); return 阅读全文
posted @ 2024-03-23 17:47 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要: Example 1: fn main() { let mut shopping_list: Vec<&str> = Vec::new(); shopping_list.push("milk"); } Example 2: struct Wrapper<T> { value: T, } impl<T> 阅读全文
posted @ 2024-03-23 17:18 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑
摘要: A baisc iter: #[test] fn main() { let my_fav_fruits = vec!["banana", "custard apple", "avocado", "peach", "raspberry"]; let mut my_iterable_fav_fruits 阅读全文
posted @ 2024-03-22 16:10 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要: function thankYouTag(arrayOfStrings,firstExpression, secondExpression, ...) { console.log( arrayOfStrings, // ["This is the first one ", " This is ano 阅读全文
posted @ 2024-03-22 02:50 Zhentiw 阅读(1) 评论(0) 推荐(0) 编辑
摘要: Symbol.for("key") Checks if a symbol with the key "key" already exists in the globals symbol registry. If yes, it returns the existing symbol, otherwi 阅读全文
posted @ 2024-03-22 02:39 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 464 下一页