Skip to content

Commit

Permalink
fix clip[py
Browse files Browse the repository at this point in the history
  • Loading branch information
vobradovich committed Nov 22, 2024
1 parent a2d2955 commit ff0b107
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 9 deletions.
4 changes: 1 addition & 3 deletions examples/demo/app/src/counter/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use sails_rs::{cell::RefCell, gstd::services::ServiceExposure, prelude::*};

use crate::ping::PingService;
use sails_rs::{cell::RefCell, prelude::*};

// Model of the service's data. Only service knows what is the data
// and how to manipulate it.
Expand Down
1 change: 1 addition & 0 deletions rs/macros/core/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ fn generate_gservice(args: TokenStream, service_impl: ItemImpl) -> TokenStream {
quote!(
#service_impl

#[allow(async_fn_in_trait)]
pub trait #trait_ident #trait_lifetimes {
#( #trait_funcs )*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ impl SomeService {
p1
}
}
#[allow(async_fn_in_trait)]
pub trait SomeServiceImplTrait {
async fn do_this(&mut self, p1: u32, p2: String) -> u32;
fn this(&self, p1: bool) -> bool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ impl SomeService {
p1
}
}
#[allow(async_fn_in_trait)]
pub trait SomeServiceImplTrait {
async fn do_this(&mut self, p1: u32, p2: String) -> u32;
fn this(&self, p1: bool) -> bool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ impl SomeService {
p1
}
}
#[allow(async_fn_in_trait)]
pub trait SomeServiceImplTrait {
async fn do_this(&mut self, p1: u32, p2: String) -> u32;
fn this(&self, p1: bool) -> bool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ impl SomeService {
p1
}
}
#[allow(async_fn_in_trait)]
pub trait SomeServiceImplTrait {
async fn do_this(&mut self, p1: u32, p2: String) -> u32;
fn this(&self, p1: bool) -> bool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl SomeService {
sails_rs::gstd::events::__notify_on(event)
}
}
#[allow(async_fn_in_trait)]
pub trait SomeServiceImplTrait {
fn do_this(&mut self) -> u32;
fn this(&self) -> bool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ impl SomeService {
42
}
}
#[allow(async_fn_in_trait)]
pub trait SomeServiceImplTrait {
fn do_this(&mut self) -> u32;
fn as_base_0(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ impl<'a> ExtendedLifetime<'a> {
"extended".to_string()
}
}
#[allow(async_fn_in_trait)]
pub trait ExtendedLifetimeImplTrait<'a> {
fn extended_name(&self) -> String;
fn name(&self) -> String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ where
sails_rs::gstd::events::__notify_on(event)
}
}
#[allow(async_fn_in_trait)]
pub trait MyGenericEventsServiceImplTrait<'a> {
fn do_this(&mut self) -> u32;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ where
42
}
}
#[allow(async_fn_in_trait)]
pub trait SomeServiceImplTrait<'a, 'b> {
fn do_this(&mut self) -> u32;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl ReferenceService {
unsafe { BYTES.last() }
}
}
#[allow(async_fn_in_trait)]
pub trait ReferenceServiceImplTrait {
fn add_byte(&mut self, byte: u8) -> &'static [u8];
fn baked(&self) -> &'static str;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ impl SomeService {
p1
}
}
#[allow(async_fn_in_trait)]
pub trait SomeServiceImplTrait {
async fn do_this(&mut self, p1: u32, p2: String) -> CommandReply<u32>;
fn this(&self, p1: bool) -> bool;
Expand Down
8 changes: 2 additions & 6 deletions rs/src/gstd/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,8 @@ impl<T1: ServiceHandle, T2: ServiceHandle> ServiceHandle for (T1, T2) {
async fn try_handle(&mut self, input: &[u8]) -> Option<(Vec<u8>, u128)> {
if let Some(result) = self.0.try_handle(input).await {
Some(result)
} else if let Some(result) = self.1.try_handle(input).await {
Some(result)
} else {
None
self.1.try_handle(input).await
}
}
}
Expand All @@ -284,10 +282,8 @@ impl<T1: ServiceHandle, T2: ServiceHandle, T3: ServiceHandle> ServiceHandle for
Some(result)
} else if let Some(result) = self.1.try_handle(input).await {
Some(result)
} else if let Some(result) = self.2.try_handle(input).await {
Some(result)
} else {
None
self.2.try_handle(input).await
}
}
}

0 comments on commit ff0b107

Please sign in to comment.