new_lambda_sink

Function new_lambda_sink 

Source
pub fn new_lambda_sink<T: Send + 'static, V: Clone + Send + 'static>(
    input_capacity: Option<usize>,
    shared_resource: V,
    function: fn(&V, T),
) -> (Sender<T>, ThreadPool)
Expand description

Creates a normal channel and connects it to a new ThreadPool to create a multi-producer multi-threaded lambda-sink.

ยงExamples

use lambda_channel::new_lambda_sink;

fn do_something(_: &Option<()>, n: i32) {
    println!("Do something without output: {}", n);
}

let (s, _p) = new_lambda_sink(Some(0), None, do_something);
s.send(1).unwrap();