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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! # LowBullMaster
//!
//! `LowBullMaster` is a trait for handling operations on keys of type `K` to produce results of type `R`.
//!
//! This trait defines two methods:
//! - `handle`: handles a single key and returns a result.
//! - `handle_many`: handles multiple keys and returns a vector of results.
//!
//! # Example
//!
//! ```
//! use lowbulls::core::LowBullMaster;
//! use anyhow::Result;
//!
//! struct ExampleBullMaster;
//!
//! impl LowBullMaster<i32, i32, i32, i32> for ExampleBullMaster {
//! fn handle(&mut self, key: i32) -> Result<i32> {
//! // Some operation on the key
//! Ok(key * 2)
//! }
//!
//!
//! fn get_resource(&self, key: i32) -> Result<i32> {
//! Ok(key)
//! }
//! }
//!
//! fn main() -> Result<()> {
//! let mut bull_master = ExampleBullMaster;
//! let keys = vec![1, 2, 3];
//! let results = bull_master.handle_many(keys)?;
//! println!("{:?}", results); // Output: [2, 4, 6]
//! Ok(())
//! }
//! ```
use Result;
/// A trait for handling operations on keys of type `K` to produce results of type `R`.