fuel_core_services/
lib.rs#![deny(clippy::arithmetic_side_effects)]
#![deny(clippy::cast_possible_truncation)]
#![deny(unused_crate_dependencies)]
#![deny(missing_docs)]
#![deny(warnings)]
mod async_processor;
mod service;
mod state;
mod sync;
#[cfg(feature = "sync-processor")]
mod sync_processor;
pub mod yield_stream;
pub mod stream {
#[doc(no_inline)]
pub use futures::stream::{
pending,
unfold,
Stream,
};
pub type BoxStream<T> =
core::pin::Pin<Box<dyn Stream<Item = T> + Send + Sync + 'static>>;
pub type RefBoxStream<'a, T> = core::pin::Pin<Box<dyn Stream<Item = T> + Send + 'a>>;
pub type BoxFuture<'a, T> =
core::pin::Pin<Box<dyn futures::Future<Output = T> + Send + Sync + 'a>>;
pub trait IntoBoxStream: Stream {
fn into_boxed(self) -> BoxStream<Self::Item>
where
Self: Sized + Send + Sync + 'static,
{
Box::pin(self)
}
fn into_boxed_ref<'a>(self) -> RefBoxStream<'a, Self::Item>
where
Self: Sized + Send + 'a,
{
Box::pin(self)
}
}
impl<S> IntoBoxStream for S where S: Stream + Send {}
}
pub trait TraceErr {
fn trace_err(self, msg: &str) -> Self;
}
impl<T, E> TraceErr for Result<T, E>
where
E: Display,
{
fn trace_err(self, msg: &str) -> Self {
if let Err(e) = &self {
tracing::error!("{} {}", msg, e);
}
self
}
}
pub use async_processor::AsyncProcessor;
pub use service::{
EmptyShared,
RunnableService,
RunnableTask,
Service,
ServiceRunner,
};
pub use state::{
State,
StateWatcher,
};
use std::fmt::Display;
pub use sync::{
Shared,
SharedMutex,
};
#[cfg(feature = "sync-processor")]
pub use sync_processor::SyncProcessor;
use crate as fuel_core_services;
#[allow(unused_imports)]
use fuel_core_services as _;