Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
WASM
Zig
Javascript
GIMPLE
Ygen
rust source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
mrustc (master)
rustc 1.0.0
rustc 1.1.0
rustc 1.10.0
rustc 1.11.0
rustc 1.12.0
rustc 1.13.0
rustc 1.14.0
rustc 1.15.1
rustc 1.16.0
rustc 1.17.0
rustc 1.18.0
rustc 1.19.0
rustc 1.2.0
rustc 1.20.0
rustc 1.21.0
rustc 1.22.0
rustc 1.23.0
rustc 1.24.0
rustc 1.25.0
rustc 1.26.0
rustc 1.27.0
rustc 1.27.1
rustc 1.28.0
rustc 1.29.0
rustc 1.3.0
rustc 1.30.0
rustc 1.31.0
rustc 1.32.0
rustc 1.33.0
rustc 1.34.0
rustc 1.35.0
rustc 1.36.0
rustc 1.37.0
rustc 1.38.0
rustc 1.39.0
rustc 1.4.0
rustc 1.40.0
rustc 1.41.0
rustc 1.42.0
rustc 1.43.0
rustc 1.44.0
rustc 1.45.0
rustc 1.45.2
rustc 1.46.0
rustc 1.47.0
rustc 1.48.0
rustc 1.49.0
rustc 1.5.0
rustc 1.50.0
rustc 1.51.0
rustc 1.52.0
rustc 1.53.0
rustc 1.54.0
rustc 1.55.0
rustc 1.56.0
rustc 1.57.0
rustc 1.58.0
rustc 1.59.0
rustc 1.6.0
rustc 1.60.0
rustc 1.61.0
rustc 1.62.0
rustc 1.63.0
rustc 1.64.0
rustc 1.65.0
rustc 1.66.0
rustc 1.67.0
rustc 1.68.0
rustc 1.69.0
rustc 1.7.0
rustc 1.70.0
rustc 1.71.0
rustc 1.72.0
rustc 1.73.0
rustc 1.74.0
rustc 1.75.0
rustc 1.76.0
rustc 1.77.0
rustc 1.78.0
rustc 1.79.0
rustc 1.8.0
rustc 1.80.0
rustc 1.81.0
rustc 1.82.0
rustc 1.9.0
rustc beta
rustc nightly
rustc-cg-gcc (master)
x86-64 GCCRS (GCC master)
x86-64 GCCRS (GCCRS master)
x86-64 GCCRS 14.1 (GCC)
x86-64 GCCRS 14.2 (GCC)
Options
Source code
use std::hint::black_box; pub fn main() { // Hack to prevent `rustc` from inling the `regular` function call let ptr: fn(_, _, _, _, _, _, _, _, _, _) -> u32 = regular; println!("{ptr:p}"); black_box(regular_bench()); } pub fn regular_bench() -> u32 { let (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) = black_box(( "4".to_owned(), 24, true, Some("5".to_owned()), Some(6), vec![1, 2, 43, 65], (10, 11), vec![12, 13, 14], "15".to_owned(), "16".to_owned(), )); regular(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) } fn regular( arg1: String, arg2: u32, arg3: bool, arg4: Option<String>, arg5: Option<u32>, arg6: Vec<u32>, arg7: (u32, u32), arg8: Vec<u32>, arg9: String, arg10: String, ) -> u32 { let x = arg1.parse::<u32>().unwrap() + arg2; let x = x + u32::from(arg3); let x = x + arg4.map(|x| x.parse::<u32>().unwrap()).unwrap_or(0); let x = x + arg5.unwrap_or(0); let x = x + arg6.iter().sum::<u32>(); let x = x + arg7.0 + arg7.1 + arg8.iter().sum::<u32>(); let x = x + arg9.parse::<u32>().unwrap(); let x = x + arg10.parse::<u32>().unwrap(); x }
rust source #2
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
mrustc (master)
rustc 1.0.0
rustc 1.1.0
rustc 1.10.0
rustc 1.11.0
rustc 1.12.0
rustc 1.13.0
rustc 1.14.0
rustc 1.15.1
rustc 1.16.0
rustc 1.17.0
rustc 1.18.0
rustc 1.19.0
rustc 1.2.0
rustc 1.20.0
rustc 1.21.0
rustc 1.22.0
rustc 1.23.0
rustc 1.24.0
rustc 1.25.0
rustc 1.26.0
rustc 1.27.0
rustc 1.27.1
rustc 1.28.0
rustc 1.29.0
rustc 1.3.0
rustc 1.30.0
rustc 1.31.0
rustc 1.32.0
rustc 1.33.0
rustc 1.34.0
rustc 1.35.0
rustc 1.36.0
rustc 1.37.0
rustc 1.38.0
rustc 1.39.0
rustc 1.4.0
rustc 1.40.0
rustc 1.41.0
rustc 1.42.0
rustc 1.43.0
rustc 1.44.0
rustc 1.45.0
rustc 1.45.2
rustc 1.46.0
rustc 1.47.0
rustc 1.48.0
rustc 1.49.0
rustc 1.5.0
rustc 1.50.0
rustc 1.51.0
rustc 1.52.0
rustc 1.53.0
rustc 1.54.0
rustc 1.55.0
rustc 1.56.0
rustc 1.57.0
rustc 1.58.0
rustc 1.59.0
rustc 1.6.0
rustc 1.60.0
rustc 1.61.0
rustc 1.62.0
rustc 1.63.0
rustc 1.64.0
rustc 1.65.0
rustc 1.66.0
rustc 1.67.0
rustc 1.68.0
rustc 1.69.0
rustc 1.7.0
rustc 1.70.0
rustc 1.71.0
rustc 1.72.0
rustc 1.73.0
rustc 1.74.0
rustc 1.75.0
rustc 1.76.0
rustc 1.77.0
rustc 1.78.0
rustc 1.79.0
rustc 1.8.0
rustc 1.80.0
rustc 1.81.0
rustc 1.82.0
rustc 1.9.0
rustc beta
rustc nightly
rustc-cg-gcc (master)
x86-64 GCCRS (GCC master)
x86-64 GCCRS (GCCRS master)
x86-64 GCCRS 14.1 (GCC)
x86-64 GCCRS 14.2 (GCC)
Options
Source code
use std::hint::black_box; pub fn main() { // Hack to prevent `rustc` from inling the `regular` function call let ptr: fn(_, _, _, _, _, _, _, _, _, _) -> u32 = regular; println!("{ptr:p}"); black_box(builder_bench()); } pub fn builder_bench() -> u32 { let (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) = black_box(( "4".to_owned(), 24, true, Some("5".to_owned()), Some(6), vec![1, 2, 43, 65], (10, 11), vec![12, 13, 14], "15".to_owned(), "16".to_owned(), )); builder() .arg1(arg1) .arg2(arg2) .arg3(arg3) .maybe_arg4(arg4) .maybe_arg5(arg5) .arg6(arg6) .arg7(arg7) .arg8(arg8) .arg9(arg9) .arg10(arg10) .call() } // Recursive expansion of builder macro // ===================================== #[inline(always)] fn builder() -> BuilderBuilder { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: bon::private::Required(::std::marker::PhantomData), arg2: bon::private::Required(::std::marker::PhantomData), arg3: bon::private::Required(::std::marker::PhantomData), arg4: bon::private::Optional(::std::marker::PhantomData), arg5: bon::private::Optional(::std::marker::PhantomData), arg6: bon::private::Required(::std::marker::PhantomData), arg7: bon::private::Required(::std::marker::PhantomData), arg8: bon::private::Required(::std::marker::PhantomData), arg9: bon::private::Required(::std::marker::PhantomData), arg10: bon::private::Required(::std::marker::PhantomData), }, } } #[doc(hidden)] trait __BuilderBuilderState { type Arg1; type Arg2; type Arg3; type Arg4; type Arg5; type Arg6; type Arg7; type Arg8; type Arg9; type Arg10; } impl<Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10> __BuilderBuilderState for (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10) { type Arg1 = Arg1; type Arg2 = Arg2; type Arg3 = Arg3; type Arg4 = Arg4; type Arg5 = Arg5; type Arg6 = Arg6; type Arg7 = Arg7; type Arg8 = Arg8; type Arg9 = Arg9; type Arg10 = Arg10; } #[must_use = "the builder does nothing until you call `call()` on it to finish building"] struct BuilderBuilder< __State: __BuilderBuilderState = ( bon::private::Required<String>, bon::private::Required<u32>, bon::private::Required<bool>, bon::private::Optional<String>, bon::private::Optional<u32>, bon::private::Required<Vec<u32>>, bon::private::Required<(u32, u32)>, bon::private::Required<Vec<u32>>, bon::private::Required<String>, bon::private::Required<String>, ), > { #[doc = r" Please don't touch this field. It's an implementation"] #[doc = r" detail that is exempt from the API stability guarantees."] #[doc = r" It's visible to you only because of the limitations of"] #[doc = r" the Rust language."] #[doc = r""] #[doc = r" The limitation is that we can't make the fields of the"] #[doc = r" generated struct private other than by placing its"] #[doc = r" declaration inside of a nested submodule. However, we"] #[doc = r" can't do that because this breaks support for fn items"] #[doc = r" declared inside of other fn items like this:"] #[doc = r""] #[doc = r" ```rustdoc_hidden"] #[doc = r" use bon::builder;"] #[doc = r""] #[doc = r" fn foo() {"] #[doc = r" struct Foo;"] #[doc = r""] #[doc = r" #[builder]"] #[doc = r" fn nested(foo: Foo) {}"] #[doc = r""] #[doc = r" nested().foo(Foo).call();"] #[doc = r" }"] #[doc = r" ```"] #[doc = r""] #[doc = r" If we were to generate a child module like this then code"] #[doc = r" in that child module would lose access to the symbol `Foo`"] #[doc = r" in the parent module. The following code doesn't compile."] #[doc = r""] #[doc = r" ```rustdoc_hidden"] #[doc = r" fn foo() {"] #[doc = r" struct Foo;"] #[doc = r""] #[doc = r" mod __private_child_module {"] #[doc = r" use super::*;"] #[doc = r""] #[doc = r" pub(super) struct Builder {"] #[doc = r" foo: Foo,"] #[doc = r" }"] #[doc = r" }"] #[doc = r" }"] #[doc = r" ```"] #[doc = r""] #[doc = r" `Foo` symbol is inaccessible inside of `__private_child_module`"] #[doc = r" because it is defined inside of the function `foo()` and not"] #[doc = r" inside of the parent module."] #[doc = r""] #[doc = r#" Child modules are kinda implicitly "hoisted" to the top-level of"#] #[doc = r" the module and they can't see the local symbols defined inside"] #[doc = r" of the same function scope."] __private_impl: __BuilderBuilderPrivateImpl<__State>, } #[doc = r" This struct exists only to reduce the number of private fields"] #[doc = r" that pop up in IDE completions for developers. It groups all"] #[doc = r" the private fields in it leaving the builder type higher with"] #[doc = r" just a single field of this type that documents the fact that"] #[doc = r" the developers shouldn't touch it."] struct __BuilderBuilderPrivateImpl<__State: __BuilderBuilderState> { _phantom: ::std::marker::PhantomData<( String, u32, bool, Option<String>, Option<u32>, Vec<u32>, (u32, u32), Vec<u32>, String, String, __State, )>, arg1: __State::Arg1, arg2: __State::Arg2, arg3: __State::Arg3, arg4: __State::Arg4, arg5: __State::Arg5, arg6: __State::Arg6, arg7: __State::Arg7, arg8: __State::Arg8, arg9: __State::Arg9, arg10: __State::Arg10, } impl<__State: __BuilderBuilderState> BuilderBuilder<__State> where __State::Arg1: ::std::convert::Into<bon::private::Set<String>>, __State::Arg2: ::std::convert::Into<bon::private::Set<u32>>, __State::Arg3: ::std::convert::Into<bon::private::Set<bool>>, __State::Arg4: ::std::convert::Into<bon::private::Set<Option<String>>>, __State::Arg5: ::std::convert::Into<bon::private::Set<Option<u32>>>, __State::Arg6: ::std::convert::Into<bon::private::Set<Vec<u32>>>, __State::Arg7: ::std::convert::Into<bon::private::Set<(u32, u32)>>, __State::Arg8: ::std::convert::Into<bon::private::Set<Vec<u32>>>, __State::Arg9: ::std::convert::Into<bon::private::Set<String>>, __State::Arg10: ::std::convert::Into<bon::private::Set<String>>, { #[doc = r" Finishes building and performs the requested action."] #[inline(always)] fn call(self) -> u32 { regular( ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg1).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg2).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg3).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg4).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg5).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg6).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg7).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg8).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg9).0, ::std::convert::Into::<bon::private::Set<_>>::into(self.__private_impl.arg10).0, ) } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg1<__State: __BuilderBuilderState> = BuilderBuilder<( bon::private::Set<String>, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg1 = bon::private::Required<String>>> BuilderBuilder<__State> { #[inline(always)] fn arg1(self, value: impl Into<String>) -> __BuilderBuilderSetArg1<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: bon::private::Set(value.into()), arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg2<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, bon::private::Set<u32>, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg2 = bon::private::Required<u32>>> BuilderBuilder<__State> { #[inline(always)] fn arg2(self, value: u32) -> __BuilderBuilderSetArg2<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: bon::private::Set(value), arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg3<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, __State::Arg2, bon::private::Set<bool>, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg3 = bon::private::Required<bool>>> BuilderBuilder<__State> { #[inline(always)] fn arg3(self, value: bool) -> __BuilderBuilderSetArg3<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: bon::private::Set(value), arg4: self.__private_impl.arg4, arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg4<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, __State::Arg2, __State::Arg3, bon::private::Set<Option<String>>, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg4 = bon::private::Optional<String>>> BuilderBuilder<__State> { #[doc = "Same as [`Self::arg4`], but accepts an `Option` as input. See that method's documentation for more details."] #[inline(always)] fn maybe_arg4(self, value: Option<impl Into<String>>) -> __BuilderBuilderSetArg4<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: bon::private::Set(value.map(Into::into)), arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } #[inline(always)] fn arg4(self, value: impl Into<String>) -> __BuilderBuilderSetArg4<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: bon::private::Set(Some(value.into())), arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg5<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, bon::private::Set<Option<u32>>, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg5 = bon::private::Optional<u32>>> BuilderBuilder<__State> { #[doc = "Same as [`Self::arg5`], but accepts an `Option` as input. See that method's documentation for more details."] #[inline(always)] fn maybe_arg5(self, value: Option<u32>) -> __BuilderBuilderSetArg5<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: bon::private::Set(value), arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } #[inline(always)] fn arg5(self, value: u32) -> __BuilderBuilderSetArg5<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: bon::private::Set(Some(value)), arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg6<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, bon::private::Set<Vec<u32>>, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg6 = bon::private::Required<Vec<u32>>>> BuilderBuilder<__State> { #[inline(always)] fn arg6(self, value: Vec<u32>) -> __BuilderBuilderSetArg6<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: self.__private_impl.arg5, arg6: bon::private::Set(value), arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg7<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, bon::private::Set<(u32, u32)>, __State::Arg8, __State::Arg9, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg7 = bon::private::Required<(u32, u32)>>> BuilderBuilder<__State> { #[inline(always)] fn arg7(self, value: (u32, u32)) -> __BuilderBuilderSetArg7<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: bon::private::Set(value), arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg8<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, bon::private::Set<Vec<u32>>, __State::Arg9, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg8 = bon::private::Required<Vec<u32>>>> BuilderBuilder<__State> { #[inline(always)] fn arg8(self, value: Vec<u32>) -> __BuilderBuilderSetArg8<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: bon::private::Set(value), arg9: self.__private_impl.arg9, arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg9<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, bon::private::Set<String>, __State::Arg10, )>; impl<__State: __BuilderBuilderState<Arg9 = bon::private::Required<String>>> BuilderBuilder<__State> { #[inline(always)] fn arg9(self, value: impl Into<String>) -> __BuilderBuilderSetArg9<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: bon::private::Set(value.into()), arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg10<__State: __BuilderBuilderState> = BuilderBuilder<( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, bon::private::Set<String>, )>; impl<__State: __BuilderBuilderState<Arg10 = bon::private::Required<String>>> BuilderBuilder<__State> { #[inline(always)] fn arg10(self, value: impl Into<String>) -> __BuilderBuilderSetArg10<__State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: self.__private_impl.arg1, arg2: self.__private_impl.arg2, arg3: self.__private_impl.arg3, arg4: self.__private_impl.arg4, arg5: self.__private_impl.arg5, arg6: self.__private_impl.arg6, arg7: self.__private_impl.arg7, arg8: self.__private_impl.arg8, arg9: self.__private_impl.arg9, arg10: bon::private::Set(value.into()), }, } } } #[doc = "Positional function equivalent of [`builder()`].\nSee its docs for details."] #[allow(clippy::too_many_arguments)] fn regular( arg1: String, arg2: u32, arg3: bool, arg4: Option<String>, arg5: Option<u32>, arg6: Vec<u32>, arg7: (u32, u32), arg8: Vec<u32>, arg9: String, arg10: String, ) -> u32 { let x = arg1.parse::<u32>().unwrap() + arg2; let x = x + u32::from(arg3); let x = x + arg4.map(|x| x.parse::<u32>().unwrap()).unwrap_or(0); let x = x + arg5.unwrap_or(0); let x = x + arg6.iter().sum::<u32>(); let x = x + arg7.0 + arg7.1 + arg8.iter().sum::<u32>(); let x = x + arg9.parse::<u32>().unwrap(); let x = x + arg10.parse::<u32>().unwrap(); x } mod bon { pub(crate) mod private { #[derive(Debug)] pub struct Required<T>(pub std::marker::PhantomData<T>); #[derive(Debug)] pub struct Optional<T>(pub std::marker::PhantomData<Option<T>>); impl<T> From<Optional<T>> for Set<Option<T>> { #[inline(always)] fn from(_: Optional<T>) -> Set<Option<T>> { const { Set(None) } } } #[repr(transparent)] #[derive(Debug)] pub struct Set<T>(pub T); } }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree