Coder Social home page Coder Social logo

bastion-rs / agnostik Goto Github PK

View Code? Open in Web Editor NEW
140.0 140.0 10.0 158 KB

Executor Agnostic Runtime that can run your futures with your favourite Executor

Home Page: https://docs.rs/agnostik

License: Apache License 2.0

Shell 1.71% Rust 98.29%
agnostic-runtime einheit-in-vielfalt executor-agnostic

agnostik's People

Contributors

chpio avatar dvc94ch avatar dylan-dpc avatar johntitor avatar keruspe avatar o0ignition0o avatar relrin avatar stupremee avatar thebutlah avatar vertexclique avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agnostik's Issues

`TokioExecutor::spawn` isn't using the set tokio runtime

let handle = tokio::task::spawn(future);

which causes a panic if you do something like:

use agnostik::prelude::*;
use tokio::runtime::Runtime;

fn main() {
    // see tokio docs for more methods to create a runtime
    let runtime = Runtime::new().expect("Failed to create a runtime"); // 1
    let runtime = Agnostik::tokio_with_runtime(runtime); // 2

    let result = runtime.spawn(async { 1337 });
    let result = runtime.block_on(result);

    assert_eq!(result, 1337);
}

(this is the code example from the agnostik docs)

My "fix" for this problem requires that the runtime is wrapped in an Arc that is cloned on each spawn, to prevent deadlocking on spawn calls inside of block_on. This isn't that ideal...

Also there is no way to use the current runtime in TokioExecutor::spawn_local.

Stopping exposing all the spawn fns, but block_on on the Executor could be better?

Or even removing the AgnostikExecutor & LocalAgnostikExecutor traits all together and just exposing a minimal set of apis through the "global" spawn etc fns? The excutor traits are just wrappers over the runtimes "global" spawn fns anyway. If there is a need for someone to start a custom runtime, then they could just use the block_on fn on tokios runtime directly (and there is no support in agnostik to change the runtime of the other async executors). This would prevent users from implementing their own custom executors and passing those a generic argument through their application (or an extension in agnostik to support custom executors in global spawn fns), see #4

What do you think?

WASM Feature

There should be a feature runtime_wasm which enables to use agnostik in a wasm environment.

Users should be able to implement their own executors

Currently, users are not able to implement the AgnostikExecutor trait for their own executors, because it's impossible to create an instance of the JoinHandle struct.

There should be a way to create a JoinHandle from a Future, which represents the Joinhandle.

Create CI build matrix

Create a CI build matrix for all major oses and all included executors in the Cargo.toml file as a feature.

Support local spawning

There should be a trait called LocalAgnostikExecutor that extends AgnostikExecutor but adds a span_local method.

bug on nightly

i'm a bit unsure if this is a temporary nightly issue, or something for us to be aware of coming up. Anyhow, thought i'd like people know.

error[E0596]: cannot borrow data in a dereference of core::pin::Pin<&mut join_handle::JoinHandle<R>> as mutable
##[error] --> src/join_handle.rs:54:39

main and test macros

Would be really cool to get attribute macros that just call agnostik::block_on(async { #body }).

Support no_std executors

Since async / await is available in no_std environment now, agnostik should add a no_std runtime.

I'm not sure if it should implement an own no_std executor or using an already existing crate.

Spawned Tasks Are not Running Detatched With Smol Executor

When I run use agnostik::spawn to spawn a task with the Smol executor feature, the task is not actually running unless I await the join handle.

I expected that the task should spawned in the "background" so to speak so I could continue executing other async code while it runs. Smol accomplishes this by detach()-ing the task, but then you can't await on it after that so that seems like it breaks the agnostik::JoinHandle. ๐Ÿค” Not sure how we want to handle that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.