diff options
author | Till Hoeppner | 2015-01-04 23:34:37 +0100 |
---|---|---|
committer | Till Hoeppner | 2015-01-04 23:34:37 +0100 |
commit | cd708c3ef3f8c070f4b0c566575fb043c4eb1e8e (patch) | |
tree | c600c8399d87fe18c4da05ad121f710ea11d2bac /src/callback.rs | |
parent | 326b5d9d96a5f45fa8b371f2a78394bcd87030e0 (diff) | |
download | irsc-cd708c3ef3f8c070f4b0c566575fb043c4eb1e8e.tar.gz irsc-cd708c3ef3f8c070f4b0c566575fb043c4eb1e8e.tar.xz irsc-cd708c3ef3f8c070f4b0c566575fb043c4eb1e8e.zip |
I should make smaller commits.
Diffstat (limited to 'src/callback.rs')
-rw-r--r-- | src/callback.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/callback.rs b/src/callback.rs index c62ebf8..b2027f6 100644 --- a/src/callback.rs +++ b/src/callback.rs @@ -1,15 +1,15 @@ -pub struct Callback<A: Sized + Send> { - items: Vec<fn(A)> +pub struct Callback<A: Sized> { + items: Vec<fn(&mut A)> } -impl<A: Sized + Clone + Send> Callback<A> { +impl<A: Sized> Callback<A> { pub fn new() -> Callback<A> { Callback { items: Vec::new() } } - pub fn register(&mut self, f: &fn(A)) { - self.items.push(*f) + pub fn register(&mut self, f: fn(&mut A)) { + self.items.push(f) } - pub fn fire(&self, v: &A) { - for _ in self.items.iter().map(|&c| c(v.clone())) {} + pub fn fire(&self, v: &mut A) { + for _ in self.items.iter().map(|&c| c(v)) {} } } |