Expand description
Common types shared among all XMTP Crates
Re-exports§
pub use retry::*;pub use wasm::*;pub use stream_handles::*;pub use const::*;pub use logging::*;
Modules§
- const
- fmt
- hex
- logging
- retry
- A retry strategy that works with rusts native
std::error::Errortype. - snippet
- stream_
handles - Consistent Stream behavior between WebAssembly and Native utilizing
tokio::task::spawnin native andwasm_bindgen_futures::spawnfor web. - time
- Time primitives for native and WebAssembly
- traced_
test - types
- Common Primitive Types that may be shared across all XMTP Crates Types should not have any dependencies other than std and std-adjacent crates (like bytes)
- wasm
Macros§
- assert_
err - wrapper over assert!(matches!()) for Errors assert_err!(fun(), StorageError::Explosion)
- assert_
logged - macro that can assert logs in tests.
Note: tests that use this must be used in
traced_testfunction and only with tokio’scurrentruntime. - assert_
ok - wrapper over assert! macros for Ok’s
- if_d14n
- Convenience macro to easily export items for d14n
- if_dev
- Feature flag for dev network
- if_
local - if_
native - Convenience macro to easily export items for native
- if_
not_ test - if_
only_ test - if_test
- if_v3
- Convenience macro to easily export items for d14n
- if_wasm
- Convenience macro to easily export items for wasm
- log_
event - optify
- Turn the
Result<T, E>into anOption<T>, logging the error withtracing::errorand returningNoneif the value matches on Result::Err(). Optionally pass a message as the second argument. - retry_
async - Retry but for an async context
- retryable
- traced_
test - wasm_
or_ native - wasm_
or_ native_ expr - Convenience macro to easily evaluate an expression for wasm or native
Structs§
- Event
Metadata - Metadata about a log event variant, including its doc comment and required context fields. This struct is used by proc macros to access event metadata at compile time.
- Fake
MlsApplication Message - Fake
MlsCommit Message - a fake mls commit message populated with garbage data can be transformed into MlsMessageOut/ProtocolMessage
- Test
LogReplace - Replace inbox id in Contextual output with a name (i.e Alix, Bo, etc.)
- Test
Writer - Thread local writer which stores logs in memory
Enums§
Traits§
- Debug
Display - Extension trait for formatting collections of Debug items in tests
- Generate
- Sha2
Digest - Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size.
Functions§
- is_
structured_ logging - Returns true if structured (JSON) logging is enabled. When true, context should not be embedded in the message to avoid duplication. Initializes from environment on first call, then caches the result.
- logger
- A simple test logger that defaults to the INFO level
- logger_
layer - rand_
account_ address - rand_
array - rand_
hexstring - rand_
i64 - rand_
secret - rand_
string - rand_
time - rand_
u64 - rand_
vec - rng
- seeded_
rng - sha256_
bytes - Sha256 is used in places where cryptographic security is not required, as sha256 has a significant speed improvement over Keccak.
- subscriber
- tmp_
path - toxiproxy_
test - wait_
for_ eq - wait_
for_ ge - wait_
for_ ok - wait_
for_ some
Type Aliases§
- Sha256
Digest - SHA-256 hasher.
Attribute Macros§
- async_
trait - A proc macro attribute that wraps the input in an
async_traitimplementation, delegating to the appropriateasync_traitimplementation based on the target architecture. - test
- A test macro that delegates to the appropriate test framework based on the target architecture.