1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! A simple Beanstalkd client.
//!
//! This crate provides a simple and easy-to-use beanstalkd client, which is inspired
//! by [beanstalkc](https://github.com/earl/beanstalkc/) and [rust-beanstalkd](https://github.com/schickling/rust-beanstalkd).
//!
//! # Usage
//!
//! ```toml
//! [dependencies]
//! beanstalkc = "^0.2.0"
//! ```
//!
//! Producer
//!
//! ```no_run
//! use std::time::Duration;
//! use beanstalkc::Beanstalkc;
//!
//! let mut conn = Beanstalkc::new()
//!      .connect()
//!      .expect("connect to beanstalkd server failed");
//!
//! conn.use_tube("jobs").unwrap();
//! conn.put_default(b"hello, world").unwrap();
//! conn.put(b"hello, rust", 1, Duration::from_secs(10), Duration::from_secs(1800)).unwrap();
//! ```
//!
//! Worker
//!
//! ```no_run
//! use beanstalkc::Beanstalkc;
//!
//! let mut conn = Beanstalkc::new()
//!      .connect()
//!      .expect("connect to beanstalkd server failed");
//!
//! conn.watch("jobs").unwrap();
//!
//! let mut job = conn.reserve().unwrap();
//! // execute job here...
//! job.delete().unwrap();
//! ```
pub use crate::beanstalkc::Beanstalkc;
pub use crate::job::Job;

mod beanstalkc;
mod command;
mod config;
mod error;
mod job;
mod request;
mod response;