Crate workflow_core

source ·
Expand description

github crates.io docs.rs license

workflow_core is a part of the workflow-rs framework, subset of which is designed to function uniformally across multiple environments including native Rust, WASM-browser and Solana OS targets.

This is a general-purpose crate that provides platform-uniform (native and WASM) abstractions for:

  • async channels
  • task spawn and sleep functions
  • random identifiers
  • async-friendly and threadsafe event triggers
  • time (Instant and Duration) structs
  • dynamic async_trait attribute macros

Modules

  • async_std::channel re-exports and shims
  • Rust enum conversion utilities
  • Access to environment variables when running natively or on top of Node.js (via process.env).
  • 64-bit random identifier struct Id that renders its value as a base58 string
  • LookupHandler provides ability to queue multiple async requests for the same key into a group of futures that resolve upon request completion.
  • task module provides helper functions for use with async closures that operate uniformly in native (tokio-backed) and WASM (async_std-backed) environments (i.e. a web browser).
  • re-export of instant crate supporting native and WASM implementations
  • trigger re-exports and shims
  • buffer slicing and other utilities

Macros

  • re-export of cfg_if crate The main macro provided by this crate. See crate documentation for more information.
  • Associates u8 values to each enum value and declares a TryFrom<u8> implementation for this enum allowing a try_from(u8) to enum conversion.
  • Associates u16 values to each enum value and declares a TryFrom<u16> implementation for this enum allowing a try_from(u16) to enum conversion.
  • Associates u32 values to each enum value and declares a TryFrom<u32> implementation for this enum allowing a try_from(u32) to enum conversion.
  • Associates usize values to each enum value and declares a TryFrom<usize> implementation for this enum allowing a try_from(usize) to enum conversion.

Attribute Macros

  • dynamically configured re-export of async_trait as workflow_async_trait that imposes Send restriction in native (non-WASM) and removes Send restriction in WASM builds.