Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 89afad8

Browse files
Updated some module exports and documentation
This commit probably won't build because the test module isn't in it.
1 parent 8f7cd4d commit 89afad8

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

‎src/error.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
pub type Error = Box<dyn std::error::Error>;
1+
/// The crates default error type. `Box<dyn std::error::Error>` by default doesn't give async
2+
/// support so it also implements `Send` and `Sync` in order to have the support (in case its ever
3+
/// needed).
4+
pub type Error = Box<dyn std::error::Error + Send + Sync>;

‎src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,23 @@
4343
//! [`prelude`]: crate::prelude
4444
//! [`TreeNode`]: crate::utils::TreeNode
4545
46+
#![warn(missing_docs)]
47+
48+
/// The module that contains the error type.
4649
pub mod error;
50+
51+
/// The module that contains all the useful macros.
52+
pub mod macros;
53+
54+
/// Contains re-exports for all the important structs.
4755
pub mod prelude;
56+
57+
#[allow(missing_docs)]
58+
#[cfg(test)]
4859
pub mod tests;
60+
61+
/// Contains the structs and macro re-exports that you can use in creating LeetCode solutions
62+
/// related to binary trees.
4963
pub mod utils;
5064

5165
pub use crate::prelude::*;

‎src/prelude.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
pub type Result<T> = core::result::Result<T, Box<dyn std::error::Error>>;
1+
use crate::error::Error;
2+
3+
/// The crate level used result type.
4+
pub type Result<T> = core::result::Result<T, Error>;
25

36
/// Common DSA Re-exports
47
pub use std::collections::{HashMap, HashSet, VecDeque};

‎src/utils/mod.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1+
/// Contains the LeetCode `ListNode` definition and implementation.
12
pub mod linked_lists;
3+
4+
/// Contains the LeetCode `TreeNode` definition and implementation.
25
pub mod trees;
36

4-
/// A re-export for the `linked_lists::ListNode` struct.
7+
///////////////////////////////////////////////////////////////////////////////////////////////////
8+
// Normal re-exports
9+
///////////////////////////////////////////////////////////////////////////////////////////////////
10+
11+
/// A re-export for the the `linked_lists::ListNode` struct.
512
pub use linked_lists::ListNode;
6-
/// A re-export for the `trees::TreeNode` struct.
13+
/// A re-export for the `linked_lists::ListNode` struct.
714
pub use trees::TreeNode;
15+
16+
///////////////////////////////////////////////////////////////////////////////////////////////////
17+
// Macro level re-exports
18+
///////////////////////////////////////////////////////////////////////////////////////////////////
19+
20+
/// A re-export for the list_node! macro
21+
pub use crate::list_node;
22+
/// A re-export for the symmetric_tree!, right_tree! and left_tree! macros.
23+
/// All of the TreeNode macros can be used to also just generate a new `TreeNode` instance without
24+
/// expanding on it.
25+
pub use crate::{left_tree, right_tree, symmetric_tree};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /