Vector of functions in Rust -


I am currently learning war and I am struggling with life span while making a simple supervisor who is an arbitrary Kind of callback will be stored.

I started with an original structure

  struct signals & lt; T & gt; {Slot: VACA & lt; | T | & Gt; }  

I got an error for the initial lifetime

  signal_test.rs:7:16: 7:19 Error: clear lifestyle bound signal_test.rs: 7 slots: VACA & lt; | T | & Gt; ^ ~ Error: Abortion due to previous error  

So next I try to add some lifetime specifiers.

  struct signals & lt; 'R, T & gt; {Slot: VACA & lt; 'R | T | & Gt; }  

I get some new errors

  signal_test.rs:7:12: 7:23 Error: Wrong number of lifetime parameters: expected 0, 1 [E0107] signal_test.rs: 7 slots: Vec & lt; 'R | T | & Gt; ^ ~~~~~~~~~~ signal_test.rs:7:19: 7:22 Error: Required bound signal_test.rs for clear lifetime: 7 slots: VACA & lt; 'R | T | & Gt;  

I can not find enough receipt lifetime documentation to signal what I need to do to fix this. It may happen that it is not a good pattern to use in war. Some help and comments will be appreciated.

Try using it:

  Structural signal & lt ; 'R, T & gt; {Slots: VACA & lt; | T |: 'r & gt; }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -