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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
use super :: *;
pub use alloc collections btree_set :: *;
/// Creates a `BTreeSet` from a list of elements.
///
/// The `bset` macro allows for convenient creation of a `BTreeSet` with initial elements.
///
/// # Origin
///
/// This collection is reexported from `alloc`.
///
/// # Syntax
///
/// The macro can be called with a comma-separated list of elements. A trailing comma is optional.
///
/// ```rust
/// # use collection_tools :: { BTreeSet, bset };
/// // BTreeSet of &str
/// let set1 = bset!( "a", "b", "c" );
///
/// // With trailing comma
/// let set3 = bset!( 1, 2, 3, );
/// ```
///
/// # Parameters
///
/// - `$( $key: expr ),* $( , )?` : A comma-separated list of elements to insert into the `BTreeSet`.
/// Each element can be of any type that implements the `Into< T >` trait, where `T` is the
/// type stored in the `BTreeSet`.
///
/// # Returns
///
/// Returns a `BTreeSet` containing all the specified elements. The capacity of the set is
/// automatically determined based on the number of elements provided.
///
/// # Example
///
/// Basic usage with string slices :
///
/// ```rust
/// # use collection_tools :: { BTreeSet, bset };
/// let set = bset!( "one", "two", "three" );
/// assert!( set.contains( "one" ) );
/// assert!( set.contains( "two" ) );
/// assert!( set.contains( "three" ) );
/// assert_eq!( set.len(), 3 );
/// ```
///
/// Creates a `BTreeSet` from a list of elements.
///
/// The `into_bset` macro allows for convenient creation of a `BTreeSet` with initial elements.
/// Elements passed to the macro are automatically converted into the set's element type
/// using `.into()`, facilitating the use of literals or values of different, but convertible types.
///
/// Note: The `into_bset` macro relies on the `.into()` method to convert each element into the target type
/// of the `BTreeSet`. This means that the elements must be compatible with the `Into< T >` trait for the
/// type `T` used in the `BTreeSet`. Also, this means that sometimes you must specify the type of collection's items.
///
/// # Origin
///
/// This collection is reexported from `alloc`.
///
/// # Syntax
///
/// The macro can be called with a comma-separated list of elements. A trailing comma is optional.
///
/// ```rust
/// # use collection_tools :: { BTreeSet, into_bset };
/// // BTreeSet of &str
/// let set1: BTreeSet< &str > = into_bset!( "a", "b", "c" );
///
/// // BTreeSet of String
/// let set2: BTreeSet< String > = into_bset!{ "a".to_string(), "b", "c" };
///
/// // With trailing comma
/// let set3: BTreeSet< i32 > = into_bset!( 1, 2, 3, );
/// ```
///
/// # Parameters
///
/// - `$( $key: expr ),* $( , )?` : A comma-separated list of elements to insert into the `BTreeSet`.
/// Each element can be of any type that implements the `Into< T >` trait, where `T` is the
/// type stored in the `BTreeSet`.
///
/// # Returns
///
/// Returns a `BTreeSet` containing all the specified elements. The capacity of the set is
/// automatically determined based on the number of elements provided.
///
/// # Example
///
/// Basic usage with string slices :
///
/// ```rust
/// # use collection_tools :: { BTreeSet, into_bset };
/// let set: BTreeSet< &str > = into_bset!( "one", "two", "three" );
/// assert!( set.contains( "one" ) );
/// assert!( set.contains( "two" ) );
/// assert!( set.contains( "three" ) );
/// assert_eq!( set.len(), 3 );
/// ```
///
/// # Example
///
/// Using with different types that implement `Into< T >` :
///
/// ```rust
/// # use collection_tools :: { BTreeSet, into_bset };
/// let numbers: BTreeSet< i32 > = into_bset!( 1, 2, 3 );
/// assert!( numbers.contains( &1 ) );
/// assert!( numbers.contains( &2 ) );
/// assert!( numbers.contains( &3 ) );
/// ```
///
/// # Example
///
/// Creating a `BTreeSet` of `String` from string literals :
///
/// ```rust
/// # use collection_tools :: { BTreeSet, into_bset };
/// let s: BTreeSet< String > = into_bset!{ "value" };
/// assert!( s.contains( "value" ) );
/// ```
///