Struct namable_closures::closures::ClosureMut[][src]

pub struct ClosureMut<'a, State, Input, Output> where
    State: 'a, 
{ /* fields omitted */ }

A namable closure that does not own its state and can mutate it when called.

It is not possible to implement Copy or Clone for this type.

Correspond to unnamable closures like:

This example is not tested
 |...| { /* mutates captured variables */ }

Example:

let mut state = 0;
{
   let mut match_cnt:ClosureMut<i32,(i32,i32),()>
       = closure!(mut state=&mut state => |a,b| {if a==b { *state+=1 }});
   for i in 0..10 { match_cnt.stable_call_mut((i,i*3%10)); }
}
assert_eq!(state,2);

Methods

impl<'a, State, Input, Output> ClosureMut<'a, State, Input, Output>
[src]

Trait Implementations

impl<'a, State, Input, Output> StableFnOnce<Input> for ClosureMut<'a, State, Input, Output>
[src]

impl<'a, State, Input, Output> StableFnMut<Input> for ClosureMut<'a, State, Input, Output>
[src]

Auto Trait Implementations

impl<'a, State, Input, Output> Send for ClosureMut<'a, State, Input, Output> where
    State: Send

impl<'a, State, Input, Output> Sync for ClosureMut<'a, State, Input, Output> where
    State: Sync