Skip to content

Commit 77e98ee

Browse files
authored
feat!: rename mox->blox (#159)
* rename mox->blox * fmt * ci
1 parent de76d75 commit 77e98ee

38 files changed

+112
-117
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ keywords = ["slack", "messages", "models", "ergonomic", "fully-documented"]
1515
categories = ["data-structures"]
1616

1717
[features]
18-
unstable = ["xml", "validation"]
19-
xml = ["mox"]
18+
unstable = ["blox", "validation"]
19+
blox = ["mox"]
2020
validation = []
2121

2222
[package.metadata.docs.rs]

Makefile.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ dependencies = ["install-fmt"]
2828

2929
[tasks.doctest-slow]
3030
command = "cargo"
31-
args = ["--locked", "test", "--features", "xml", "--jobs", "1", "--doc", "--", "--quiet"]
31+
args = ["--locked", "test", "--features", "blox", "--jobs", "1", "--doc", "--", "--quiet"]
3232

3333
[tasks.doctest]
3434
command = "cargo"
35-
args = ["--locked", "test", "--features", "xml", "--doc", "--", "--quiet"]
35+
args = ["--locked", "test", "--features", "blox", "--doc", "--", "--quiet"]
3636

3737
[tasks.test]
3838
command = "cargo"
39-
args = ["--locked", "test", "--features", "xml", "--tests", "--", "--quiet"]
39+
args = ["--locked", "test", "--features", "blox", "--tests", "--", "--quiet"]
4040
dependencies = ["doctest"]
4141

4242
[tasks.tdd]

src/blocks/actions.rs

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ pub mod build {
161161
/// Invoked by `blox!` when a child element is passed to `<actions_block>`.
162162
///
163163
/// Alias of `ActionsBuilder.element`.
164+
#[cfg(feature = "blox")]
165+
#[cfg_attr(docsrs, doc(cfg(feature = "blox")))]
164166
pub fn child<El>(self,
165167
element: El)
166168
-> ActionsBuilder<'a, Set<method::elements>>

src/blocks/context.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ pub mod build {
127127
}
128128

129129
/// Alias of `element` for appending an element with an XML child.
130-
#[cfg(feature = "xml")]
131-
#[cfg_attr(docsrs, doc(cfg(feature = "xml")))]
130+
#[cfg(feature = "blox")]
131+
#[cfg_attr(docsrs, doc(cfg(feature = "blox")))]
132132
pub fn child<El>(self,
133133
element: El)
134134
-> ContextBuilder<'a, Set<method::elements>>

src/blocks/input.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ pub mod build {
265265
}
266266

267267
/// XML child alias for `element`
268-
#[cfg(feature = "xml")]
269-
#[cfg_attr(docsrs, doc(cfg(feature = "xml")))]
268+
#[cfg(feature = "blox")]
269+
#[cfg_attr(docsrs, doc(cfg(feature = "blox")))]
270270
pub fn child<El>(self,
271271
element: El)
272272
-> InputBuilder<'a, Set<method::element>, L>

src/blocks/section.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,9 @@ pub mod build {
229229
///
230230
/// To set `text`, use the `text` attribute.
231231
/// ```
232-
/// use mox::mox;
233-
/// use slack_blocks::{blocks::Section, mox::*, text, text::ToSlackPlaintext};
232+
/// use slack_blocks::{blocks::Section, blox::*, text, text::ToSlackPlaintext};
234233
///
235-
/// let xml = mox! {
234+
/// let xml = blox! {
236235
/// <section_block text={"Section".plaintext()}>
237236
/// <text kind=plain>"Foo"</text>
238237
/// <text kind=plain>"Bar"</text>
@@ -246,8 +245,8 @@ pub mod build {
246245
///
247246
/// assert_eq!(xml, equiv);
248247
/// ```
249-
#[cfg(feature = "xml")]
250-
#[cfg_attr(docsrs, doc(cfg(feature = "xml")))]
248+
#[cfg(feature = "blox")]
249+
#[cfg_attr(docsrs, doc(cfg(feature = "blox")))]
251250
pub fn child<T>(self, text: T) -> SectionBuilder<'a, Set<method::text>>
252251
where T: Into<text::Text>
253252
{

src/mox.rs src/blox.rs

+31-34
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
//! # XML macro support
2-
//!
3-
//! This module provides shorthands for builder functions
4-
//! to be used with `mox` or a similar "xml -> Builder" macro.
1+
//! # XML macro builder support
52
63
pub use elems::{button::Style::{Danger as btn_danger,
74
Primary as btn_primary},
@@ -26,11 +23,11 @@ pub trait IntoChild: Sized {
2623

2724
impl<T> IntoChild for T {}
2825

29-
pub use mox_blocks::*;
30-
pub use mox_compose::*;
31-
pub use mox_elems::*;
26+
pub use blox_blocks::*;
27+
pub use blox_compose::*;
28+
pub use blox_elems::*;
3229

33-
mod mox_blocks {
30+
mod blox_blocks {
3431
use super::*;
3532

3633
/// # Build an actions block
@@ -40,7 +37,7 @@ mod mox_blocks {
4037
///
4138
/// ## Example
4239
/// ```
43-
/// use slack_blocks::{blocks::Actions, elems::Button, mox::*, text};
40+
/// use slack_blocks::{blocks::Actions, blox::*, elems::Button, text};
4441
///
4542
/// let xml = blox! {
4643
/// <actions_block>
@@ -74,7 +71,7 @@ mod mox_blocks {
7471
///
7572
/// ## Example
7673
/// ```
77-
/// use slack_blocks::{blocks::Section, mox::*, text};
74+
/// use slack_blocks::{blocks::Section, blox::*, text};
7875
///
7976
/// let xml = blox! {
8077
/// <section_block text=blox!{<text kind=plain>"Foo"</text>} />
@@ -100,7 +97,7 @@ mod mox_blocks {
10097
///
10198
/// ## Example
10299
/// ```
103-
/// use slack_blocks::{blocks::Input, elems::TextInput, mox::*, text};
100+
/// use slack_blocks::{blocks::Input, blox::*, elems::TextInput, text};
104101
///
105102
/// let xml = blox! {
106103
/// <input_block label="foo">
@@ -126,7 +123,7 @@ mod mox_blocks {
126123
///
127124
/// ## Example
128125
/// ```
129-
/// use slack_blocks::{blocks::Context, elems::Image, mox::*, text};
126+
/// use slack_blocks::{blocks::Context, blox::*, elems::Image, text};
130127
///
131128
/// let xml = blox! {
132129
/// <context_block>
@@ -158,7 +155,7 @@ mod mox_blocks {
158155
///
159156
/// ## Example
160157
/// ```
161-
/// use slack_blocks::{blocks::File, mox::*};
158+
/// use slack_blocks::{blocks::File, blox::*};
162159
///
163160
/// let xml = blox! {
164161
/// <file_block external_id="foo" />
@@ -179,7 +176,7 @@ mod mox_blocks {
179176
///
180177
/// ## Example
181178
/// ```
182-
/// use slack_blocks::{blocks::Image, mox::*};
179+
/// use slack_blocks::{blocks::Image, blox::*};
183180
///
184181
/// let xml = blox! {
185182
/// <img_block src="https://foo.com/bar.png" alt="a pic of bar" />
@@ -196,7 +193,7 @@ mod mox_blocks {
196193
}
197194
}
198195

199-
mod mox_elems {
196+
mod blox_elems {
200197
use super::*;
201198

202199
/// # Build an text input element
@@ -206,7 +203,7 @@ mod mox_elems {
206203
///
207204
/// ## Example
208205
/// ```
209-
/// use slack_blocks::{elems::TextInput, mox::*};
206+
/// use slack_blocks::{blox::*, elems::TextInput};
210207
///
211208
/// let xml: TextInput = blox! {
212209
/// <text_input action_id="name_input"
@@ -238,7 +235,7 @@ mod mox_elems {
238235
///
239236
/// ## Example
240237
/// ```
241-
/// use slack_blocks::{elems::Image, mox::*};
238+
/// use slack_blocks::{blox::*, elems::Image};
242239
///
243240
/// let xml: Image = blox! {
244241
/// <img src="https://foo.com/bar.png" alt="a pic of bar" />
@@ -261,7 +258,7 @@ mod mox_elems {
261258
///
262259
/// ## Example
263260
/// ```
264-
/// use slack_blocks::{elems::Button, mox::*};
261+
/// use slack_blocks::{blox::*, elems::Button};
265262
///
266263
/// let xml: Button = blox! {
267264
/// <button action_id="click_me">"Click me!"</button>
@@ -284,7 +281,7 @@ mod mox_elems {
284281
///
285282
/// ## Example
286283
/// ```
287-
/// use slack_blocks::{compose::Opt, elems::Checkboxes, mox::*};
284+
/// use slack_blocks::{blox::*, compose::Opt, elems::Checkboxes};
288285
///
289286
/// let xml: Checkboxes = blox! {
290287
/// <checkboxes action_id="chex">
@@ -328,7 +325,7 @@ mod mox_elems {
328325
///
329326
/// ## Example
330327
/// ```
331-
/// use slack_blocks::{elems::DatePicker, mox::*};
328+
/// use slack_blocks::{blox::*, elems::DatePicker};
332329
///
333330
/// let xml = blox! {
334331
/// <date_picker action_id="pick_birthday" placeholder="Pick your birthday!" />
@@ -354,7 +351,7 @@ mod mox_elems {
354351
///
355352
/// ## Example
356353
/// ```
357-
/// use slack_blocks::{compose::Opt, elems::Overflow, mox::*};
354+
/// use slack_blocks::{blox::*, compose::Opt, elems::Overflow};
358355
///
359356
/// let xml = blox! {
360357
/// <overflow action_id="menu">
@@ -386,7 +383,7 @@ mod mox_elems {
386383
///
387384
/// ## Example
388385
/// ```
389-
/// use slack_blocks::{blocks::Input, compose::Opt, elems::Radio, mox::*};
386+
/// use slack_blocks::{blocks::Input, blox::*, compose::Opt, elems::Radio};
390387
///
391388
/// let xml = blox! {
392389
/// <input_block label="Pick your favorite cheese!">
@@ -423,8 +420,8 @@ mod mox_elems {
423420
/// # Build a select menu
424421
///
425422
/// # Attributes
426-
/// - `kind` (Optional): `single` or `multi` from `slack_blocks::mox`. Default is `single`.
427-
/// - `choose_from` (Required): `users`, `public_channels`, `static_`, `external`, `conversations` from `slack_blocks::mox`
423+
/// - `kind` (Optional): `single` or `multi` from `slack_blocks::blox`. Default is `single`.
424+
/// - `choose_from` (Required): `users`, `public_channels`, `static_`, `external`, `conversations` from `slack_blocks::blox`
428425
///
429426
/// # Children
430427
/// For `static_`, 1-100 `<option>` children are allowed.
@@ -439,7 +436,7 @@ mod mox_elems {
439436
/// # Example - Select many Users
440437
/// ```
441438
/// use slack_blocks::elems::select;
442-
/// use slack_blocks::mox::*;
439+
/// use slack_blocks::blox::*;
443440
///
444441
/// let xml = blox! {
445442
/// <select kind=multi choose_from=users placeholder="Pick some users!" action_id="foo" />
@@ -452,7 +449,7 @@ mod mox_elems {
452449
///
453450
/// # Example - Select an option from a list defined by your app
454451
/// ```
455-
/// use slack_blocks::{elems::select, compose::Opt, mox::*};
452+
/// use slack_blocks::{elems::select, compose::Opt, blox::*};
456453
///
457454
/// let xml = blox! {
458455
/// <select choose_from=static_ placeholder="Pick your favorite cheese!" action_id="foo">
@@ -478,7 +475,7 @@ mod mox_elems {
478475
}
479476
}
480477

481-
mod mox_compose {
478+
mod blox_compose {
482479
use super::*;
483480

484481
/// # Text
@@ -490,7 +487,7 @@ mod mox_compose {
490487
///
491488
/// ## Example
492489
/// ```
493-
/// use slack_blocks::{blocks::Section, mox::*, text};
490+
/// use slack_blocks::{blocks::Section, blox::*, text};
494491
///
495492
/// let xml = blox! {
496493
/// <text kind=plain>"Foo"</text>
@@ -514,7 +511,7 @@ mod mox_compose {
514511
///
515512
/// ## Example
516513
/// ```
517-
/// use slack_blocks::{compose::Opt, mox::*};
514+
/// use slack_blocks::{blox::*, compose::Opt};
518515
///
519516
/// let xml = blox! {
520517
/// <option value="foo">
@@ -543,8 +540,8 @@ mod mox_compose {
543540
///
544541
/// ## Example - Options known at compile-time
545542
/// ```
546-
/// use slack_blocks::{compose::{Opt, OptGroup},
547-
/// mox::*};
543+
/// use slack_blocks::{blox::*,
544+
/// compose::{Opt, OptGroup}};
548545
///
549546
/// let xml = blox! {
550547
/// <option_group label="foos_and_bars">
@@ -567,8 +564,8 @@ mod mox_compose {
567564
///
568565
/// ## Example - Dynamic vec of options
569566
/// ```
570-
/// use slack_blocks::{compose::{Opt, OptGroup},
571-
/// mox::*};
567+
/// use slack_blocks::{blox::*,
568+
/// compose::{Opt, OptGroup}};
572569
///
573570
/// # fn uuid() -> String {"foo".to_string()}
574571
/// # fn random_word() -> String {"foo".to_string()}
@@ -609,7 +606,7 @@ mod mox_compose {
609606
///
610607
/// ## Example
611608
/// ```
612-
/// use slack_blocks::{compose::Confirm, mox::*, text::ToSlackPlaintext};
609+
/// use slack_blocks::{blox::*, compose::Confirm, text::ToSlackPlaintext};
613610
///
614611
/// let xml = blox! {
615612
/// <confirm title="Title"

src/compose/opt.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,9 @@ pub mod build {
316316
impl<'a, V, U> OptBuilder<'a, RequiredMethodNotCalled<method::text>, V, U> {
317317
/// Alias for `text`, allowing you to set the text of the option like so:
318318
/// ```
319-
/// use mox::mox;
320-
/// use slack_blocks::{compose::Opt, mox::*, text};
319+
/// use slack_blocks::{blox::*, compose::Opt, text};
321320
///
322-
/// let xml = mox! {
321+
/// let xml = blox! {
323322
/// <option value="foo">
324323
/// <text kind=plain>"Foo"</text>
325324
/// </option>
@@ -331,8 +330,8 @@ pub mod build {
331330
///
332331
/// assert_eq!(xml, equiv)
333332
/// ```
334-
#[cfg(feature = "xml")]
335-
#[cfg_attr(docsrs, doc(cfg(feature = "xml")))]
333+
#[cfg(feature = "blox")]
334+
#[cfg_attr(docsrs, doc(cfg(feature = "blox")))]
336335
pub fn child<T: Into<text::Text>>(
337336
self,
338337
text: T)

src/compose/opt_group.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ pub mod build {
260260
}
261261

262262
/// XML child alias for `option`.
263-
#[cfg(feature = "xml")]
264-
#[cfg_attr(docsrs, doc(cfg(feature = "xml")))]
263+
#[cfg(feature = "blox")]
264+
#[cfg_attr(docsrs, doc(cfg(feature = "blox")))]
265265
pub fn child<T2, U2>(
266266
self,
267267
option: Opt<'a, T2, U2>)
@@ -281,8 +281,8 @@ pub mod build {
281281
}
282282

283283
/// XML child alias for `option`.
284-
#[cfg(feature = "xml")]
285-
#[cfg_attr(docsrs, doc(cfg(feature = "xml")))]
284+
#[cfg(feature = "blox")]
285+
#[cfg_attr(docsrs, doc(cfg(feature = "blox")))]
286286
pub fn child(self, option: Opt<'a, T, U>) -> Self {
287287
self.option(option)
288288
}

0 commit comments

Comments
 (0)