MCPcopy Create free account
hub / github.com/SharpCoder/teensycore / test2

Function test2

src/system/closure.rs:62–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61 #[test]
62 fn test2() {
63 let mut list = Vector::new();
64
65 fn convert<T: Copy>(closure: Closure<T>) -> *const u32 {
66 let ptr = &closure as *const Closure<T>;
67 return ptr as *const u32;// as *const u32;
68 }
69
70 list.push(Box::new(Closure::bind(&invoke, ("hello", 42))));
71 list.push(Box::new(Closure::bind(&invoke2, ("worldz", 12, "you are great"))));
72
73 for closure in list.into_iter() {
74 let func = Box::from_raw::<Closure::<(&str, i32, &str)>>(closure);
75 func.invoke();
76 }
77 }
78
79 fn invoke2(message: (&str, i32, &str)) {
80 std::println!("[invoke2] {} {} {}", message.0, message.1, message.2);

Callers

nothing calls this directly

Calls 3

invokeMethod · 0.80
pushMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected