Transmissing metainfo across components.

Related tags

Cryptography rust volo
Overview

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);
}

Related Projects

  • 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

You might also like...
An implementation of webauthn components for Rustlang servers

Webauthn-rs Webauthn is a modern approach to hardware based authentication, consisting of a user with an authenticator device, a browser or client tha

🕺 Run React code snippets/components from your command-line without config

Run React code snippets/components from your command-line without config.

A collection of components and widgets that are built for bevy_ui and the ECS pattern

Widgets for Bevy UI A collection of components and widgets that are built for bevy_ui and the ECS pattern. Current State This was started recently and

WASM bindings for React - enables you to write and use React components in Rust

This library enables you to write and use React components in Rust, which then can be exported to JS to be reused or rendered.

Pathfinding on grids using jumping point search and connected components.

grid_pathfinding A grid-based pathfinding system. Implements Jump Point Search with improved pruning rules for speedy pathfinding. Pre-computes connec

Pure Rust implementation of components of the Secure Shell (SSH) protocol

RustCrypto: SSH Pure Rust implementation of components of the Secure Shell (SSH) protocol. Crates Name crates.io Docs Description ssh—encoding Decoder

implementations of standard library components for bare-metal aarch64

aarch64-std aarch64-std implements components from the Rust standard library in a way suitable for no_std or bare metal ARM applications. Design Goals

A monorepo containing all the custom components of the Astria network

A monorepo containing all the custom components of the Astria network, a decentralized system that replaces traditional sequencers, offering a shared, permissionless sequencer network.

Components of Fornjot that are no longer actively maintained. Pull requests still welcome!

Fornjot - Extra Components About These are extra components from the Fornjot repository, that are no longer actively maintained. Fornjot's goal was to

Reactive components in rust, designed to make GTK more manageable

gflux gflux is a tiny experimental reactive component system for rust, designed to make GTK more manageable. gflux: is about 300 lines of code contain

Transform jsx/tsx files to reactive views in js/ts to use in Web Components, insert into DOM or integrate with other libraries/frameworks
Transform jsx/tsx files to reactive views in js/ts to use in Web Components, insert into DOM or integrate with other libraries/frameworks

viewmill Features | Installation | Getting Started | Notes | Examples viewmill is aimed to create complex UIs from a simple form of JSX. It statically

Rust Server Components. JSX-like syntax and async out of the box.

RSCx - Rust Server Components RSCx is a server-side HTML rendering engine library with a neat developer experience and great performance. Features: al

Supercharge your markdown including RSCx components.

rscx-mdx Render Markdown into HTML, while having custom RSCx components inside. Usage use rscx::{component, html, props}; use rscx_mdx::mdx::{Mdx, Mdx

Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

AccessKit: UI accessibility infrastructure across platforms and programming languages

AccessKit: UI accessibility infrastructure across platforms and programming languages Motivation There are numerous UI toolkits, and new ones continue

Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...
Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...

LibAFL, the fuzzer library. Advanced Fuzzing Library - Slot your own fuzzers together and extend their features using Rust. LibAFL is written and main

Zenith substitutes PostgreSQL storage layer and redistributes data across a cluster of nodes

Zenith substitutes PostgreSQL storage layer and redistributes data across a cluster of nodes

clockchain is a system for benchmarking smart contract execution times across blockchains.
clockchain is a system for benchmarking smart contract execution times across blockchains.

Clockchain Clockchain is a research tool for benchmarking smart contract execution times across blockchains using Arcesco-- a block-chain agnostic ins

clockchain is a system for benchmarking smart contract execution times across blockchains.
clockchain is a system for benchmarking smart contract execution times across blockchains.

Clockchain Clockchain is a research tool for benchmarking smart contract execution times across blockchains using Arcesco-- a block-chain agnostic ins

Comments
  • 关于 kv.rs 代码实现的疑惑

    关于 kv.rs 代码实现的疑惑

    Bug Report

    kv.rs 文件中,关于宏的实现使用疑惑

    set_impl!(persistent);
    set_impl!(transient);
    set_impl!(stale);
    
    del_impl!(persistent);
    del_impl!(transient);
    del_impl!(stale);
    
    get_impl!(persistent);
    get_impl!(transient);
    get_impl!(stale);
    
    get_all_impl!(persistent);
    get_all_impl!(transient);
    get_all_impl!(stale);
    

    Description

    为啥不改成一个宏实现?是跟性能相关吗?

    macro_rules! make_setters_and_getters {
        ($($field:ident),*) => {
            paste! {
                $(
                    pub fn [<set_ $field>]<K: Into<Cow<'static, str>>, V: Into<Cow<'static, str>>>(
                        &mut self,
                        key: K,
                        value: V,
                    ) {
                        if self.$field.is_none() {
                            self.$field = Some(HashMap::with_capacity(DEFAULT_CAPACITY));
                        }
                        self.$field.as_mut().unwrap().insert(key.into(), value.into());
                    }
                    pub fn [<del_ $field>]<K: AsRef<str>>(&mut self, key: K) {
                        let key = key.as_ref();
                        if let Some(v) = self.$field.as_mut() {
                            v.remove(key);
                        }
                    }
                    pub fn [<get_ $field>]<K: AsRef<str>>(&self, key: K) -> Option<&str> {
                        let key = key.as_ref();
                        match self.$field.as_ref() {
                            Some(v) => {
                                v.get(key).map(|v| v.as_ref())
                            }
                            None => None,
                        }
                    }
                    pub fn [<get_all_ $field s>](&self) -> Option<&HashMap<Cow<'static, str>, Cow<'static, str>>> {
                        self.$field.as_ref()
                    }
                )*
            }
        }
    }
    
    impl Node {
        make_setters_and_getters!(persistent, transient, stale);
    }
    
    opened by zxbeltm 2
  • document how to passthrough metainfo by frameworks / 补充框架如何使用 metainfo 进行信息透传的文档

    document how to passthrough metainfo by frameworks / 补充框架如何使用 metainfo 进行信息透传的文档

    Currently there's no document about how to use this to passthrough information by frameworks, and we need to document it clearly.

    现在没有关于框架如何使用这个库进行信息透传的详细文档,我们应当补充一个。

    C-maintenance E-easy E-help-wanted T-good-first-issue A-metainfo 
    opened by PureWhiteWu 0
Releases(0.6.3)
  • 0.6.3(Sep 23, 2022)

    What's Changed

    • ci: unify ci name by @PureWhiteWu in https://github.com/cloudwego/metainfo/pull/3
    • ci: remove rust-cache by @PureWhiteWu in https://github.com/cloudwego/metainfo/pull/4
    • fix: clear does not clear trans info by @PureWhiteWu in https://github.com/cloudwego/metainfo/pull/5

    Full Changelog: https://github.com/cloudwego/metainfo/compare/0.6.2...0.6.3

    Source code(tar.gz)
    Source code(zip)
Owner
CloudWeGo
A leading practice for building enterprise-class cloud native architectures!
CloudWeGo
A monorepo containing all the custom components of the Astria network

A monorepo containing all the custom components of the Astria network, a decentralized system that replaces traditional sequencers, offering a shared, permissionless sequencer network.

Astria 6 Jun 7, 2023
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.6k Dec 30, 2022
clockchain is a system for benchmarking smart contract execution times across blockchains.

Clockchain Clockchain is a research tool for benchmarking smart contract execution times across blockchains using Arcesco-- a block-chain agnostic ins

Zeke Medley 7 Oct 3, 2022
clockchain is a system for benchmarking smart contract execution times across blockchains.

Clockchain Clockchain is a research tool for benchmarking smart contract execution times across blockchains using Arcesco-- a block-chain agnostic ins

zeke 7 Oct 3, 2022
Open source p2p share for devs to share anything with teammates across machines securely.

Secure share Share anything with teammates across machines via CLI. Share is a tool for secure peer-to-peer connections, enabling direct communication

Onboardbase 10 Aug 4, 2023
Reusable components for the Arduino Uno.

Ruduino This library provides a set of reusable components for the Arduino Uno. Overview Register and bit definitions use ruduino::cores::current::POR

The AVR-Rust project 610 Dec 28, 2022
An implementation of webauthn components for Rustlang servers

Webauthn-rs Webauthn is a modern approach to hardware based authentication, consisting of a user with an authenticator device, a browser or client tha

Kanidm 232 Jan 8, 2023
Rewind is a snapshot-based coverage-guided fuzzer targeting Windows kernel components.

Rewind is a snapshot-based coverage-guided fuzzer targeting Windows kernel components.

Quarkslab 259 Dec 26, 2022
NPM package distributing biscuit in WebAssembly for web components

Biscuit playground This is an example application for Biscuit tokens, where you can manipulate tokens and their verification in your browser. build wi

null 0 Dec 30, 2021