projects
/
rust-101.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tune explanation of PhantomData ownership annotation
[rust-101.git]
/
workspace
/
src
/
part12.rs
diff --git
a/workspace/src/part12.rs
b/workspace/src/part12.rs
index a3519957ca7dbfcf0d207f6004c3fa3df909ff1e..23db4f60e586faa8eca2eb1951b93ef1a30bef69 100644
(file)
--- a/
workspace/src/part12.rs
+++ b/
workspace/src/part12.rs
@@
-13,7
+13,7
@@
struct Callbacks {
impl Callbacks {
pub fn new() -> Self {
impl Callbacks {
pub fn new() -> Self {
- unimplemented!()
+ Callbacks { callbacks: Vec::new() }
}
// Registration works just like last time, except that we are creating an `Rc` now.
}
// Registration works just like last time, except that we are creating an `Rc` now.
@@
-69,11
+69,10
@@
struct CallbacksMut {
impl CallbacksMut {
pub fn new() -> Self {
impl CallbacksMut {
pub fn new() -> Self {
- unimplemented!()
+ CallbacksMut { callbacks: Vec::new() }
}
pub fn register<F: FnMut(i32)+'static>(&mut self, callback: F) {
}
pub fn register<F: FnMut(i32)+'static>(&mut self, callback: F) {
- let cell = Rc::new(RefCell::new(callback));
unimplemented!()
}
unimplemented!()
}