From 3f5616c0f225b824c19ba6b9c8d84ddfa6c5b15a Mon Sep 17 00:00:00 2001 From: Markus Mayer Date: Sat, 15 Jun 2024 14:31:01 +0200 Subject: [PATCH] Add a compile_fail test for mandatory fields Signed-off-by: Markus Mayer --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 1f60d73a..2a9a8588 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -256,6 +256,19 @@ impl Optional 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”) ///