Skip to content

Commit

Permalink
Fix multiple macro usage
Browse files Browse the repository at this point in the history
  • Loading branch information
zeritiq committed Apr 16, 2023
1 parent 0e28783 commit 54a0af6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mongodb-macro"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
description = "MongoDB Macro is a crate with macros for quickly creating structures to work with mongodb"
keywords = [ "mongodb", "macro", "config", "clap" ]
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Make sure you also add to the project:
### Macro: Collection
```rust

use clap::Parser;
use mongodb::bson::Bson;

// env DB_URL should contain a link to the mongodb url
Expand All @@ -56,6 +57,7 @@ async fn main() -> std::io::Result<()> {
### Macro: Database
```rust

use clap::Parser;
use mongodb::bson::Bson;

// env DB_URL should contain a link to the mongodb url
Expand All @@ -79,6 +81,7 @@ async fn main() -> std::io::Result<()> {
### Macro: Client
```rust

use clap::Parser;
use mongodb::bson::Bson;

// env DB_URL should contain a link to the mongodb url
Expand All @@ -102,6 +105,7 @@ async fn main() -> std::io::Result<()> {
### Macro: Config
```rust

use clap::Parser;
use mongodb::bson::Bson;

mongodb_macro::config!(Opts);
Expand All @@ -126,6 +130,6 @@ async fn main() -> std::io::Result<()> {
}
```

Current version: 1.0.2
Current version: 1.0.3

License: MIT
1 change: 0 additions & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ macro_rules! client_config {
($opts:ident) => ($crate::client_config!{$opts; "DB_URL"});

($opts:ident; $db_url:tt) => {
use ::clap::Parser;

#[derive(Clone, Debug, PartialEq, Eq, ::clap::Parser)]
pub struct $opts {
Expand Down
1 change: 0 additions & 1 deletion src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ macro_rules! database_config {
($opts:ident) => ($crate::database_config!{$opts; ("DB_URL", "DB_NAME")});

($opts:ident; ($db_url:tt, $db_name:tt)) => {
use ::clap::Parser;

#[derive(Clone, Debug, PartialEq, Eq, ::clap::Parser)]
pub struct $opts {
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Make sure you also add to the project:
## Macro: Collection
```no_run
use clap::Parser;
use mongodb::bson::Bson;
// env DB_URL should contain a link to the mongodb url
Expand All @@ -44,6 +45,7 @@ async fn main() -> std::io::Result<()> {
## Macro: Database
```no_run
use clap::Parser;
use mongodb::bson::Bson;
// env DB_URL should contain a link to the mongodb url
Expand All @@ -67,6 +69,7 @@ async fn main() -> std::io::Result<()> {
## Macro: Client
```no_run
use clap::Parser;
use mongodb::bson::Bson;
// env DB_URL should contain a link to the mongodb url
Expand All @@ -90,6 +93,7 @@ async fn main() -> std::io::Result<()> {
## Macro: Config
```no_run
use clap::Parser;
use mongodb::bson::Bson;
mongodb_macro::config!(Opts);
Expand Down
2 changes: 0 additions & 2 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ macro_rules! config {
($opts:ident, $prefix:tt) => ($crate::config!{$opts, $prefix; ("DB_URL", "DB_NAME", "COLLECTION_NAME")});

($opts:ident, $prefix:tt; ($db_url:tt, $db_name:tt, $collection_name:tt)) => {
use ::clap::Parser;

#[derive(Clone, Debug, PartialEq, Eq, ::clap::Parser)]
pub struct $opts {
Expand All @@ -71,7 +70,6 @@ macro_rules! config {
($opts:ident) => ($crate::config!{$opts; "DB_URL", "DB_NAME", "COLLECTION_NAME"});

($opts:ident; $db_url:tt, $db_name:tt, $collection_name:tt) => {
use ::clap::Parser;

#[derive(Clone, Debug, PartialEq, Eq, ::clap::Parser)]
pub struct $opts {
Expand Down

0 comments on commit 54a0af6

Please sign in to comment.