Skip to content

Commit

Permalink
Add a compile_fail test for mandatory fields
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Mayer <widemeadows@gmail.com>
  • Loading branch information
sunsided committed Jun 15, 2024
1 parent effbe43 commit 3f5616c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@ impl<T> Optional<T> for (T,) {
// crate is all we can use.

#[doc(hidden)]
/// When a property is non-default, you can't ignore it:
///
/// ```compile_fail
/// use typed_builder::TypedBuilder;
///
/// #[derive(TypedBuilder)]
/// struct Foo {
/// x: i8,
/// }
///
/// let _ = Foo::builder().build();
/// ```
///
/// When a property is skipped, you can't set it:
/// (“method `y` not found for this”)
///
Expand Down

0 comments on commit 3f5616c

Please sign in to comment.