Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove async-trait #33

Closed
wants to merge 1 commit into from
Closed

remove async-trait #33

wants to merge 1 commit into from

Conversation

al8n
Copy link
Contributor

@al8n al8n commented Jan 18, 2024

No description provided.

@al8n al8n added the enhancement New feature or request label Jan 18, 2024
@al8n al8n self-assigned this Jan 18, 2024
pub trait ServiceCore: Sized + ServiceData {
/// Initialize the service with the given state
fn init(service_state: ServiceStateHandle<Self>) -> Result<Self, super::DynError>;

/// Service main loop
async fn run(mut self) -> Result<(), super::DynError>;
fn run(self) -> impl Future<Output = Result<(), super::DynError>> + Send;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, for async methods that return something that need to be send we need to use impl Future instead of async?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we use async, by default there is no Send bound.

@al8n al8n closed this Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants