spark-channel 0.0.2

A generic channel listener implementation for Spark Rust SDK
Documentation
//! # Spark Channel
//!
//! This crate is used to send messages between modules. This crate is not specific to any of the traits but a generic implementation to implement them in an event-driven architecture.

use tokio::sync::oneshot;

/// A sender for a callback.
pub type CallbackSender<V> = oneshot::Sender<V>;

/// A wrapper for a callback.
pub struct CallbackWrapper<T, V> {
    /// The message.
    pub message: T,

    /// The sender for the callback.
    pub sender: CallbackSender<V>,
}

impl<T, V> CallbackWrapper<T, V> {
    /// Get the inner values as owned values.
    pub(crate) fn inner_owned(self) -> (T, CallbackSender<V>) {
        return (self.message, self.sender)
    }
}