Skip to content

Commit

Permalink
docs: fix a few typos
Browse files Browse the repository at this point in the history
  • Loading branch information
murar8 committed Dec 14, 2024
1 parent 9e0106f commit b7c966d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
1 change: 1 addition & 0 deletions .idea/axum_typed_multipart.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions macros/src/impls/try_from_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub fn macro_impl(input: TokenStream) -> TokenStream {
}
});

quote! {
let res = quote! {
#[axum::async_trait]
impl ::axum_typed_multipart::TryFromField for #ident {
async fn try_from_field(
Expand All @@ -78,6 +78,7 @@ pub fn macro_impl(input: TokenStream) -> TokenStream {
}
}
}
}
.into()
};

res.into()
}
2 changes: 1 addition & 1 deletion macros/src/impls/try_from_multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl FieldData {
}
}

/// Parse the supplied human readable size limit into a byte limit.
/// Parse the supplied human-readable size limit into a byte limit.
fn limit_bytes(&self) -> Option<usize> {
match self.limit.as_deref() {
None => Some(DEFAULT_FIELD_SIZE_LIMIT_BYTES),
Expand Down
2 changes: 1 addition & 1 deletion macros/tests/test_strict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async fn test_strict_unknown_field() {
}

#[tokio::test]
async fn test_strict_deplicate_field() {
async fn test_strict_duplicate_field() {
async fn handler(_: TypedMultipart<Data>) {
panic!("should not be called");
}
Expand Down
2 changes: 1 addition & 1 deletion src/base_multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use axum::response::IntoResponse;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};

/// Used as as an argument for axum [Handlers](axum::handler::Handler).
/// Used as an argument for axum [Handlers](axum::handler::Handler).
///
/// Implements [FromRequest] when the generic argument implements the
/// [TryFromMultipart] trait and the generic rejection implements the
Expand Down
20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
//!
//! If the request body is malformed the request will be aborted with an error.
//!
//! An error will be returned if at least one field is missing, with the exception of [Option] and
//! [Vec] types, which will be set respectively as [Option::None] and `[]`.
//! An error will be returned if at least one field is missing, except for [Option] and
//! [Vec] types, which will be set respectively as [None] and `[]`.
//!
//! ```rust,no_run
#![doc = include_str!("../examples/basic.rs")]
Expand Down Expand Up @@ -118,7 +118,7 @@
//! ### Field metadata
//!
//! If you need access to the field metadata (e.g. the field headers like file name or content
//! type) you can use the [FieldData](crate::FieldData) struct to wrap your field.
//! type) you can use the [FieldData](FieldData) struct to wrap your field.
//! ```rust
//! use axum::body::Bytes;
//! use axum_typed_multipart::{FieldData, TryFromMultipart};
Expand Down Expand Up @@ -172,10 +172,10 @@
//!
//! ### Strict mode
//!
//! By default the derive macro will store the last occurrence of a field and it will ignore
//! By default, the derive macro will store the last occurrence of a field, and it will ignore
//! unknown fields. This behavior can be changed by using the `strict` parameter in the derive
//! macro. This will make the macro throw an error if the request contains multiple fields with the
//! same name or if it contains unknown fields. In addition when using strict mode sending fields
//! same name or if it contains unknown fields. In addition, when using strict mode sending fields
//! with a missing or empty name will result in an error.
//! ```rust
//! use axum_typed_multipart::TryFromMultipart;
Expand Down Expand Up @@ -230,19 +230,19 @@
//! [TryFromField](crate::TryFromField) trait for your type. This will allow the derive macro to
//! generate the [TryFromMultipart](crate::TryFromMultipart) implementation automatically. Instead
//! of implementing the trait directly, it is recommended to implement the
//! [TryFromChunks](crate::TryFromChunks) trait and the [TryFromField](crate::TryFromField) trait
//! [TryFromChunks](TryFromChunks) trait and the [TryFromField](crate::TryFromField) trait
//! will be implemented automatically. This is recommended since you won't need to manually
//! implement the size limit logic.
//!
//! To implement the [TryFromChunks](crate::TryFromChunks) trait for external types you will need
//! To implement the [TryFromChunks](TryFromChunks) trait for external types you will need
//! to create a newtype wrapper and implement the trait for the wrapper.
//!
//! ### Custom error format
//!
//! When using [TypedMultipart](crate::TypedMultipart) as an argument for your handlers, when the
//! When using [TypedMultipart](TypedMultipart) as an argument for your handlers, when the
//! request is malformed, the error will be serialized as a string. If you would like to customize
//! the error format you can use the [BaseMultipart](crate::BaseMultipart) struct instead. This
//! struct is used internally by [TypedMultipart](crate::TypedMultipart) and it can be used to
//! the error format you can use the [BaseMultipart](BaseMultipart) struct instead. This
//! struct is used internally by [TypedMultipart](TypedMultipart) and it can be used to
//! customize the error type.
//!
//! To customize the error you will need to define a custom error type and implement
Expand Down
2 changes: 1 addition & 1 deletion src/typed_multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use axum::async_trait;
use axum::extract::{FromRequest, Request};
use std::ops::{Deref, DerefMut};

/// Used as as an argument for axum [Handlers](axum::handler::Handler).
/// Used as an argument for axum [Handlers](axum::handler::Handler).
///
/// Implements [FromRequest] when the generic argument implements the
/// [TryFromMultipart] trait.
Expand Down

0 comments on commit b7c966d

Please sign in to comment.