-
-
Save daboross/a4bd5c71156e436172b9e2eea37fe766 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error[E0412]: cannot find type `F` in this scope | |
--> derive/tests/derive_generics.rs:15:53 | |
| | |
15 | fn get<F>(&mut self, _: &mut (), msg: GetTarget<F>) -> u32 | |
| ^ help: a trait with a similar name exists: `Fn` | |
error[E0412]: cannot find type `F` in this scope | |
--> derive/tests/derive_generics.rs:15:53 | |
| | |
15 | fn get<F>(&mut self, _: &mut (), msg: GetTarget<F>) -> u32 | |
| ^ help: a type parameter with a similar name exists: `A` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Clone, Default, Debug, Deserialize, Serialize, TransferOwnership)] | |
pub struct RoomTargets; | |
#[process(process_type = ::ProcessType)] | |
impl RoomTargets { | |
#[sync_msg] | |
fn get<F>(&mut self, _: &mut (), msg: GetTarget<F>) -> u32 | |
where | |
F: FnOnce(u32) -> u32 + Message, | |
{ | |
(msg.get)(5) | |
} | |
} | |
#[derive(Clone, Default, Debug, Deserialize, Serialize, TransferOwnership)] | |
pub struct GetTarget<F: FnOnce(u32) -> u32> { | |
get: F, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<F> ::tungsten::SyncMessageReceiver<GetTarget<F>> for RoomTargets | |
where | |
F: FnOnce(u32) -> u32 + Message, | |
{ | |
type Result = u32; | |
fn recv(&mut self, _: &mut (), msg: GetTarget<F>) -> u32 { | |
(msg.get)(5) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment