摘要:
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
阅读(13)
评论(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
阅读(21)
评论(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
阅读(11)
评论(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
阅读(13)
评论(0)
推荐(0)