mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-23 08:01:19 +00:00
Merge pull request #1343 from tomaka/derive-poll-context
Pass &mut std::task::Context to poll
This commit is contained in:
commit
c0e78f2dfb
@ -389,7 +389,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream {
|
|||||||
syn::NestedMeta::Meta(syn::Meta::NameValue(ref m)) if m.path.is_ident("poll_method") => {
|
syn::NestedMeta::Meta(syn::Meta::NameValue(ref m)) if m.path.is_ident("poll_method") => {
|
||||||
if let syn::Lit::Str(ref s) = m.lit {
|
if let syn::Lit::Str(ref s) = m.lit {
|
||||||
let ident: Ident = syn::parse_str(&s.value()).unwrap();
|
let ident: Ident = syn::parse_str(&s.value()).unwrap();
|
||||||
poll_method = quote!{#name::#ident(self)};
|
poll_method = quote!{#name::#ident(self, cx)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => ()
|
||||||
|
@ -130,7 +130,7 @@ fn custom_polling() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<TSubstream> Foo<TSubstream> {
|
impl<TSubstream> Foo<TSubstream> {
|
||||||
fn foo<T>(&mut self) -> std::task::Poll<libp2p::swarm::NetworkBehaviourAction<T, ()>> { std::task::Poll::Pending }
|
fn foo<T>(&mut self, _: &mut std::task::Context) -> std::task::Poll<libp2p::swarm::NetworkBehaviourAction<T, ()>> { std::task::Poll::Pending }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@ -186,7 +186,7 @@ fn custom_event_and_polling() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<TSubstream> Foo<TSubstream> {
|
impl<TSubstream> Foo<TSubstream> {
|
||||||
fn foo<T>(&mut self) -> std::task::Poll<libp2p::swarm::NetworkBehaviourAction<T, String>> { std::task::Poll::Pending }
|
fn foo<T>(&mut self, _: &mut std::task::Context) -> std::task::Poll<libp2p::swarm::NetworkBehaviourAction<T, String>> { std::task::Poll::Pending }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user