Skip to content

Commit

Permalink
test(http): fix docs test
Browse files Browse the repository at this point in the history
  • Loading branch information
zavakid committed Dec 4, 2024
1 parent 0bcc559 commit 576cd11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
4 changes: 0 additions & 4 deletions crates/http/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
/// * `$predicate` - A boolean expression that should evaluate to true
/// * `$error` - The error value to return if the predicate is false
///
/// # Example
///
/// ```
/// ensure!(headers.len() < MAX_HEADERS, ParseError::TooManyHeaders);
/// ```
macro_rules! ensure {
($predicate:expr, $error:expr) => {
Expand Down
15 changes: 8 additions & 7 deletions crates/web/src/fn_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
//!
//! # Examples
//!
//! ```rust
//! use micro_web::fn_trait::FnTrait;
//!
//! ```no_run
//! // Handler with no parameters
//! async fn handler0() -> &'static str {
//! "Hello World!"
Expand Down Expand Up @@ -46,15 +44,16 @@ use std::future::Future;
/// # Examples
///
/// ```rust
/// use micro_web::fn_trait::FnTrait;
/// use http::Method;
/// use http::Method;///
///
/// use micro_web::FnTrait;
///
/// async fn my_handler(method: &Method) -> String {
/// format!("Handling {} request", method)
/// }
///
/// // The function automatically implements FnTrait
/// fn assert_handler<F: FnTrait<(&Method,)>>(f: F) {}
/// fn assert_handler<'r, F: FnTrait<(&'r Method,)>>(f: F) {}
/// assert_handler(my_handler);
/// ```
pub trait FnTrait<Args>: Send + Sync {
Expand All @@ -75,8 +74,10 @@ pub trait FnTrait<Args>: Send + Sync {
///
/// # Example Generated Implementation
///
/// ```rust
/// ```ignore
/// // For a two-parameter function:
/// use micro_web::FnTrait;
///
/// impl<Func, Fut, A, B> FnTrait<(A, B)> for Func
/// where
/// Func: Fn(A, B) -> Fut + Send + Sync,
Expand Down

0 comments on commit 576cd11

Please sign in to comment.