A local function in Rust
问题 In there any way in Rust to create a local function which can be called more than once . The way I'd do that in Python is: def method1(): def inner_method1(): print("Hello") inner_method1() inner_method1() 回答1: Yes, you can define functions inside functions: fn method1() { fn inner_method1() { println!("Hello"); } inner_method1(); inner_method1(); } However, inner functions don't have access to the outer scope. They're just normal functions that are not accessible from outside the function.