slawlor / ractor

Rust actor framework
MIT License
1.3k stars 66 forks source link

With async-trait turned off, it is impossible to use factory #248

Closed Jaraxzus closed 3 days ago

Jaraxzus commented 6 days ago

I use rust 1.79, since it already has support for asynchronous traits, I turned off the feature with them due to runtime errors rustc: lifetime parameters or bounds on method `pre_start` do not match the trait declaration lifetimes do not match method in trait [E0195] After switching off, the ability to use factory disappeared. rustc: unresolved import `ractor::factory` could not find `factory` in `ractor` [E0432] Пример из toml

ractor = { version = "0.10.3", default-features = false, features = [
  "tokio_runtime",
  "blanket_serde",
  "cluster",
  # "async-trait",
] }
slawlor commented 6 days ago

This is by design for now, until I can work out all the edge cases for native async traits in factories.

In lib.rs

#[cfg(feature = "async-trait")
mod factory;
Jaraxzus commented 6 days ago

Should we expect this in the near future?

slawlor commented 6 days ago

There might be a blocker to this functionality if memory serves. You can't use boxed traits with the native async traits functionality so I think that's related but I'll need to investigate it again. Feel free to open an issue and we can track the work.

You're also welcome to propose a solution. I haven't revisited it since factory has been rewritten, so we may be further along in that path to getting it to work