All Projects → Xudong-Huang → May_actor

Xudong-Huang / May_actor

Licence: other
Local Actor library based on may

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to May actor

Coobjc
coobjc provides coroutine support for Objective-C and Swift. We added await method、generator and actor model like C#、Javascript and Kotlin. For convenience, we added coroutine categories for some Foundation and UIKit API in cokit framework like NSFileManager, JSON, NSData, UIImage etc. We also add tuple support in coobjc.
Stars: ✭ 3,921 (+20536.84%)
Mutual labels:  coroutine, actor
Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+3531.58%)
Mutual labels:  coroutine
Hyperf
🚀 A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.
Stars: ✭ 4,206 (+22036.84%)
Mutual labels:  coroutine
Libfiber
The high performance coroutine library for Linux/FreeBSD/MacOS/Windows, supporting select/poll/epoll/kqueue/iocp/windows GUI
Stars: ✭ 519 (+2631.58%)
Mutual labels:  coroutine
Akka.net
Port of Akka actors for .NET
Stars: ✭ 4,024 (+21078.95%)
Mutual labels:  actor
Yappi
Yet Another Python Profiler, but this time thread&coroutine&greenlet aware.
Stars: ✭ 595 (+3031.58%)
Mutual labels:  coroutine
Spring Kotlin Coroutine
Kotlin coroutine support for Spring.
Stars: ✭ 359 (+1789.47%)
Mutual labels:  coroutine
Actix
Actor framework for Rust.
Stars: ✭ 6,764 (+35500%)
Mutual labels:  actor
Imi
imi 是基于 Swoole 的 PHP 协程开发框架,它支持 Http、Http2、WebSocket、TCP、UDP、MQTT 等主流协议的服务开发,特别适合互联网微服务、即时通讯聊天im、物联网等场景!。QQ群:17916227
Stars: ✭ 680 (+3478.95%)
Mutual labels:  coroutine
Swow
Coroutine-based concurrency library for PHP
Stars: ✭ 475 (+2400%)
Mutual labels:  coroutine
Et
Unity3D Client And C# Server Framework
Stars: ✭ 5,138 (+26942.11%)
Mutual labels:  actor
Swoft
🚀 PHP Microservice Full Coroutine Framework
Stars: ✭ 5,420 (+28426.32%)
Mutual labels:  coroutine
Easyswoole
swoole,easyswoole,swoole framework
Stars: ✭ 4,409 (+23105.26%)
Mutual labels:  coroutine
Qpc
QP/C real-time embedded framework/RTOS for embedded systems based on active objects (actors) and hierarchical state machines
Stars: ✭ 379 (+1894.74%)
Mutual labels:  actor
Qbit
The Java microservice lib. QBit is a reactive programming lib for building microservices - JSON, HTTP, WebSocket, and REST. QBit uses reactive programming to build elastic REST, and WebSockets based cloud friendly, web services. SOA evolved for mobile and cloud. ServiceDiscovery, Health, reactive StatService, events, Java idiomatic reactive programming for Microservices.
Stars: ✭ 702 (+3594.74%)
Mutual labels:  actor
Ananas
A C++11 RPC framework based on future and protobuf, with utility: timer,ssl,future/promise,log,coroutine,etc
Stars: ✭ 361 (+1800%)
Mutual labels:  coroutine
Posterus
Composable async primitives with cancelation, control over scheduling, and coroutines. Superior replacement for JS Promises.
Stars: ✭ 536 (+2721.05%)
Mutual labels:  coroutine
Actor
A type-safe Actor class and WiredActor for sending functions as messages
Stars: ✭ 16 (-15.79%)
Mutual labels:  actor
Paysdk
PHP 集成支付 SDK ,集成了支付宝、微信支付的支付接口和其它相关接口的操作。支持 php-fpm 和 Swoole,所有框架通用。宇润PHP全家桶技术支持群:17916227
Stars: ✭ 723 (+3705.26%)
Mutual labels:  coroutine
Ray
项目停止更新,新项目:https://github.com/RayTale/Vertex
Stars: ✭ 635 (+3242.11%)
Mutual labels:  actor

Build Status Build status Current Crates.io Version Document

may_actor

rust native actor library based on may

with this library

  • you don’t need to declare messages that passed into the actor
  • you don’t have to implement “actor” interface or trait for your actor.
  • the actors will automatically have M:N scheduling powered by may

Usage

extern crate may_actor;
use may_actor::Actor;

fn main() {
    struct HelloActor(u32);
    let a = Actor::new(HelloActor(0));

    a.call(|me| {
        me.0 = 10;
        println!("hello world");
    });
    // the with would wait previous messages process done
    a.with(|me| println!("actor value is {}", me.0));
}

for a detailed example, please see pi.rs

Features

  • send message via closure (Actor.call)

You can send messages to the actor with the call API. It accepts a closure that has the &mut T as parameter, so that you can change it’s internal state. The closure would be send to a queue inside the actor, and the actor would execute the closure asynchronously by a coroutine that associate with it . This API would not block user’s execution and would return immediately. if panic happens in the closure, it will be caught and ignored in actor's coroutine context.

  • synchronously run a closure within actor coroutine context (Actor.with)

You can also synchronously manipulate the actor's internal state by the with API. It accepts a closure that has the &mut T as parameter, so that you can view or modify actor's internal state. The closure would be executed by the associated coroutine if there are no other pending messages. And it will block until the closure returns the result to caller. If any panic happens in the closure, it will propagate to the caller's context

  • convert from raw instance reference to Actor (Actor.from)

You can transmute a &self type unsafely to it's handle type Actor<T>. This is convenient when need to get an actor handle in the implementation that need to pass as a function parameter.

However transmute from non actor context would trigger undefined behavior.

  • Allow panic inside a closure message, and this would not kill the actor, the actor will continue to process successive messages.

  • The actor can be cloned to get a new handle, this is just like how Arc<T> works, if all the actor handle got dropped, the associated coroutine will automatically exit.

Notice

  • Actor will catch panic and ignore the panic if any happened when processing a message, so there is no supervisor and restart policy right now. The actor only exit if all handles are dropped by user.
  • Don't call thread block APIs in passed in closures, call May version APIs instead.
  • This simple library doesn't support spawn actors across processes

License

may_actor is licensed under either of the following, at your option:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].