lwleen-rpc 1.3.3

RPC (信令路由), 组件间数据通信
Documentation
//! 🛸 `信令路由`(RPC)
//! # 介绍
//! 主页 [Homepage](https://docs.qq.com/aio/p/sc3gu8sft77pu68)  
//! crates官方仓库  [https://crates.io/crates/lwleen](https://crates.io/crates/lwleen)  
//! 
//! RPC 是 Remote Procedure Call(远程过程调用),用于组件间数据通信 
//! 
//! # 信令路由
//! 可扩展,自定义服务器  
//! [https://docs.rs/crate/lwleen-rpc/latest/source/src/mod_rpc.rs](https://docs.rs/crate/lwleen-rpc/latest/source/src/mod_rpc.rs)    

#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
// #![allow(dead_code)]


#[macro_use]
pub mod macros;          // 宏     顶层直接调用宏

// 模块
pub mod mod_rpc;
pub mod mod_pool;
pub mod mod_state;
pub mod mod_timer;
pub mod mod_tool;
pub mod mod_demo;



// 重新导出常用模块
pub use anyhow;
pub use serde;
pub use serde_json;
pub use futures;
pub use futures_lite;          // pub use parking;
pub use async_channel;
pub use crossbeam_channel;
pub use chrono;
pub use uuid;
pub use lwleen_macro;
// pub use smol;





/// prelude  `预接口`
/// > `⚡️信令路由`  `💖常用库`  `🌷常用的方法` 
/// 
/// ```no_run
/// 下面是 lwleen_rpc 导出的💖常用库
/// use anyhow
/// use serde
/// use serde_json
/// use lwleen_rpc::futures
/// use futures_lite
/// use async_channel
/// use crossbeam_channel
/// use chrono
/// use uuid
/// use lwleen_macro
/// ```
pub mod prelude{
    
    pub use std::{ 
        // std::fmt::{Display, Debug},
        // std::time::Instant, 
        borrow::Cow,
        sync::{ Arc, atomic::{ AtomicBool,AtomicUsize,AtomicU64,Ordering}},    // Mutex, RwLock
        boxed::Box, pin::Pin, // pin 宏
        any::{ Any },
        cell::{ Cell, RefCell },                                               //Cell<Copy或Default类型>     RefCell<任意复杂类型> 提供内部可变性   无须 mut 通过不可变引用修改数据  
        collections::{HashMap,HashSet},
    };
    pub use dashmap::{ DashMap,DashSet};                                    //💖自带锁管理, 但有线程Sync限制, HashMap更自由💖
    // pub use indexmap::{ IndexMap,IndexSet};


    pub use anyhow::{ Error as anyhow_Error, Result as anyhow_Result, anyhow as anyhow_err, Ok as anyhow_Ok };
    pub use once_cell::sync::{OnceCell, Lazy};                              // 替代  std::sync::OnceLock 自定义延迟初始化   lazy_static 延迟初始化
    pub use parking_lot::{ Mutex, RwLock, Condvar, Once};                   //1.5x faster than std::sync::Mutex when uncontended, and up to 5x faster when contended from multiple threads
    pub use serde::{ Serialize, Deserialize };
    pub use serde_json::{ json, Value, from_value, from_str, from_slice };
    pub use futures::{ join, try_join, select, channel::oneshot };    // join!()  必须等待所有完成    try_join!()  有一个错误,立即结束  select!()  任何一个 Future 结束后,都可以立即被处理结果

    pub use async_lock::{ Mutex as async_Mutex, RwLock as async_RwLock };
    // pub use flume::{
    //     Receiver as flume_Receiver, Sender as flume_Sender,
    //     bounded as flume_bounded, unbounded as flume_unbounded,
    // };
    pub use async_channel::{
        Receiver as async_Receiver,Sender as async_Sender,                      // force_send   send_blocking   recv_blocking 
        bounded as async_bounded, unbounded as async_unbounded,
    };
    /// - 仓库 <https://crates.io/crates/futures-lite>
    /// - 代码 <https://docs.rs/futures-lite/latest/src/futures_lite/future.rs.html#53-102>
    pub use futures_lite::future::block_on as block_on_lite;
    // pub use async_io;                                                        //后台有个服务线程   `async-io`   // 不支持wasm32
    pub use futures_timer::Delay;                                               //后台有个服务线程   src/native/global.rs ::HelperThread



    pub use lwleen_macro::{ gen_特征_derive, EnumDisplay  };
    pub use crate::{
        cfg_if, cfg_多行特性, 
        match取出,
        impl信令特征,
        core发布信令任务,
        anyhow_Ok信令, anyhow_Err信令,
        join_path,
    };
    pub use crate::mod_tool::{
        全局_启动时间,全局_CPU数量,
        TIME时间, 线程同步控制,
        原子ID, 原子ID对象,
    };
    pub use crate::mod_rpc::{
        rpc类型,
        信令路由,
        信令任务Builder, 信令任务,
        Box信令特征, 信令特征,                 // Send 是所有权可以转移线程  +  Sync 是可以多线程访问
        信令异步执行函数, 
        信令ID, 信令发送包,
        rpc路由状态, 
        定时器,
    };
    pub use crate::mod_pool::{  ThreadPool, Builder as ThreadPool_Builder };
    pub use crate::mod_state::{ StateManager, State  };
    pub use crate::mod_timer::{ Timeout限时特征 };
}