17 releases

new 0.7.5 Jun 1, 2023
0.7.2 Apr 27, 2023
0.7.1 Mar 1, 2023
0.6.3 Sep 23, 2022
0.2.1 Jul 14, 2021

#130 in Network programming

Download history 125/week @ 2023-02-09 128/week @ 2023-02-16 121/week @ 2023-02-23 87/week @ 2023-03-02 82/week @ 2023-03-09 201/week @ 2023-03-16 50/week @ 2023-03-23 60/week @ 2023-03-30 92/week @ 2023-04-06 79/week @ 2023-04-13 69/week @ 2023-04-20 93/week @ 2023-04-27 160/week @ 2023-05-04 90/week @ 2023-05-11 144/week @ 2023-05-18 203/week @ 2023-05-25

617 downloads per month
Used in 4 crates (3 directly)

MIT/Apache

355KB
883 lines

Metainfo

Crates.io Documentation License Build Status

Transmissing metainfo across components.

Quickstart

Metainfo is designed to be passed through task local, so we provided a unified key for it metainfo::METAINFO, and we recommend you to use it this way:

METAINFO.scope(...)

MetaInfo is used to passthrough information between components and even client-server.

It supports two types of info: typed map and string k-v.

It is designed to be tree-like, which means you can share a MetaInfo with multiple children.

Note: only the current scope is mutable.

Example:

use metainfo::MetaInfo;

fn test() {
    let mut m1 = MetaInfo::new();
    m1.insert::<i8>(2);
    assert_eq!(*m1.get::<i8>().unwrap(), 2);

    let (mut m1, mut m2) = m1.derive();
    assert_eq!(*m2.get::<i8>().unwrap(), 2);

    m2.insert::<i8>(4);
    assert_eq!(*m2.get::<i8>().unwrap(), 4);

    m2.remove::<i8>();
    assert_eq!(*m2.get::<i8>().unwrap(), 2);
}
  • Volo: A high-performance and strong-extensibility Rust RPC framework that helps developers build microservices.
  • Volo-rs: The volo ecosystem which contains a lot of useful components.
  • Motore: Middleware abstraction layer powered by GAT.
  • Pilota: A thrift and protobuf implementation in pure rust with high performance and extensibility.

Contributing

See CONTRIBUTING.md for more information.

License

Metainfo is dual-licensed under the MIT license and the Apache License (Version 2.0).

See LICENSE-MIT and LICENSE-APACHE for details.

Community

Dependencies

~0.6–5MB
~71K SLoC