some docs...
This commit is contained in:
parent
b4359ec202
commit
894327ba00
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
/target
|
/target
|
||||||
result*
|
result*
|
||||||
|
scrap.md
|
12
src/lib.rs
12
src/lib.rs
|
@ -90,7 +90,7 @@ impl WorkerConfig {
|
||||||
/// Enable secure connection to amqp.
|
/// Enable secure connection to amqp.
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
/// * `custom_tls` - Optional TLSconfig (if none defaults to lapins choice)
|
/// * `custom_tls` - Optional [`TlsConfig`] (if none defaults to lapins choice)
|
||||||
pub fn enable_tls(mut self, custom_tls: Option<TlsConfig>) -> Self {
|
pub fn enable_tls(mut self, custom_tls: Option<TlsConfig>) -> Self {
|
||||||
match custom_tls {
|
match custom_tls {
|
||||||
Some(tls) => {
|
Some(tls) => {
|
||||||
|
@ -151,10 +151,10 @@ impl ListenerConfig {
|
||||||
|
|
||||||
// TODO implement reconnect
|
// TODO implement reconnect
|
||||||
impl Worker {
|
impl Worker {
|
||||||
/// Create a new instance of `bunbun-worker`
|
/// Create a new instance of [`Worker`]
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
/// * `amqp_server_url` - A string slice that holds the url of the amqp server (e.g. amqp://localhost:5672)
|
/// * `amqp_server_url` - A string slice that holds the url of the amqp server (e.g. amqp://localhost:5672)
|
||||||
/// * `config` - A worker config, containing the TLS config for now.
|
/// * `config` - A [`WorkerConfig`], containing the TLS config for now.
|
||||||
pub async fn new(amqp_server_url: impl Into<String>, config: WorkerConfig) -> Self {
|
pub async fn new(amqp_server_url: impl Into<String>, config: WorkerConfig) -> Self {
|
||||||
let channel = Self::create_channel(amqp_server_url.into(), config).await;
|
let channel = Self::create_channel(amqp_server_url.into(), config).await;
|
||||||
|
|
||||||
|
@ -191,11 +191,11 @@ impl Worker {
|
||||||
channel
|
channel
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a non-rpc listener to the worker object
|
/// Add a [`Task`] listener to the worker object
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
/// * `state` - An Arc of the state object that will be passed to the listener
|
/// * `state` - An Arc of the state object that will be passed to the listener
|
||||||
/// * `listener_config` - An Arc of the state object that will be passed to the listener
|
/// * `listener_config` - [`ListenerConfig`] that holds the configuration for the listener
|
||||||
/// ```
|
/// ```
|
||||||
/// use bunbun_worker::{Worker, ListenerConfig, WorkerConfig};
|
/// use bunbun_worker::{Worker, ListenerConfig, WorkerConfig};
|
||||||
/// let server = Worker::new("amqp://localhost:5672", Workerconfig::default()).await;
|
/// let server = Worker::new("amqp://localhost:5672", Workerconfig::default()).await;
|
||||||
|
@ -563,7 +563,7 @@ pub trait RPCTask: Sized + Debug + DeserializeOwned {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A regular task
|
/// A regular task
|
||||||
/// Implement this trait to any struct to make it a runnable `non-rpc` job.
|
/// Implement this trait to any struct to make it a runnable `non-rpc` [`Task`] job.
|
||||||
///
|
///
|
||||||
/// Examples
|
/// Examples
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue