Skip to content

Commit

Permalink
doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Sep 17, 2023
1 parent 3f91134 commit 6d7331a
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,56 @@
//! ## Export your bindings
//!
//! ```rust
//! # #[specta::specta]
//! # fn greet() {}
//! # #[specta::specta]
//! # fn greet2() {}
//! # #[specta::specta]
//! # fn greet3() {}
//! use specta::collect_types;
//! use tauri_specta::{ts, js};
//! #[tauri::command]
//! #[specta::specta]
//! fn greet() {}
//! #[tauri::command]
//! #[specta::specta]
//! fn greet2() {}
//! #[tauri::command]
//! #[specta::specta]
//! fn greet3() {}
//! use tauri_specta::*;
//!
//! // this example exports your types on startup when in debug mode or in a unit test. You can do whatever.
//! fn main() {
//! #[cfg(debug_assertions)]
//! ts::export(collect_types![greet, greet2, greet3], "../src/bindings.ts").unwrap();
//! ts::builder()

Check warning on line 71 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:71:4 | 71 | //! ts::builder() | ^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments note: the lint level is defined here --> src/lib.rs:111:9 | 111 | #![warn(clippy::all, clippy::unwrap_used, clippy::panic | ^^^^^^^^^^^ = note: `#[warn(clippy::tabs_in_doc_comments)]` implied by `#[warn(clippy::all)]`
//! .commands(collect_commands![greet, greet2, greet3])

Check warning on line 72 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:72:4 | 72 | //! .commands(collect_commands![greet, greet2, greet3]) | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .path("../src/bindings.ts")

Check warning on line 73 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:73:4 | 73 | //! .path("../src/bindings.ts") | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .export()

Check warning on line 74 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:74:4 | 74 | //! .export() | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .unwrap();

Check warning on line 75 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:75:4 | 75 | //! .unwrap(); | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//!
//! // or export to JS with JSDoc
//! #[cfg(debug_assertions)]
//! js::export(collect_types![greet, greet2, greet3], "../src/bindings.js").unwrap();
//! js::builder()

Check warning on line 79 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:79:4 | 79 | //! js::builder() | ^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .commands(collect_commands![greet, greet2, greet3])

Check warning on line 80 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:80:4 | 80 | //! .commands(collect_commands![greet, greet2, greet3]) | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .path("../src/bindings.js")

Check warning on line 81 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:81:4 | 81 | //! .path("../src/bindings.js") | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .export()

Check warning on line 82 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:82:4 | 82 | //! .export() | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .unwrap();

Check warning on line 83 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:83:4 | 83 | //! .unwrap(); | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! }
//!
//! #[test]
//! fn export_bindings() {
//! ts::export(collect_types![greet, greet2, greet3], "../src/bindings.ts").unwrap();
//! js::export(collect_types![greet, greet2, greet3], "../src/bindings.js").unwrap();
//! ts::builder()

Check warning on line 88 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:88:4 | 88 | //! ts::builder() | ^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .commands(collect_commands![greet, greet2, greet3])

Check warning on line 89 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:89:4 | 89 | //! .commands(collect_commands![greet, greet2, greet3]) | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .path("../src/bindings.ts")

Check warning on line 90 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:90:4 | 90 | //! .path("../src/bindings.ts") | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .export()

Check warning on line 91 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:91:4 | 91 | //! .export() | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .unwrap();

Check warning on line 92 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:92:4 | 92 | //! .unwrap(); | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//!
//! js::builder()

Check warning on line 94 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:94:4 | 94 | //! js::builder() | ^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .commands(collect_commands![greet, greet2, greet3])

Check warning on line 95 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:95:4 | 95 | //! .commands(collect_commands![greet, greet2, greet3]) | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .path("../src/bindings.js")

Check warning on line 96 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:96:4 | 96 | //! .path("../src/bindings.js") | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .export()

Check warning on line 97 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:97:4 | 97 | //! .export() | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! .unwrap();

Check warning on line 98 in src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

using tabs in doc comments is not recommended

warning: using tabs in doc comments is not recommended --> src/lib.rs:98:4 | 98 | //! .unwrap(); | ^^^^^^^^^^^^ help: consider using four spaces per tab | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
//! }
//! ```
//!
//! ## Usage on frontend
//!
//! ```ts
//! import * as commands from "./bindings"; // This should point to the file we export from Rust
//! import { commands } from "./bindings"; // This should point to the file we export from Rust
//!
//! await commands.greet("Brendan");
//! ```
Expand Down

0 comments on commit 6d7331a

Please sign in to comment.