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", 24, true, Some("5"), Some(6), &[1, 2, 43, 65], (10, 11), [12, 13, 14], "15", "16", )); regular(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) } fn regular( arg1: &str, arg2: u32, arg3: bool, arg4: Option<&str>, arg5: Option<u32>, arg6: &[u32], arg7: (u32, u32), arg8: [u32; 3], arg9: &str, arg10: &str, ) -> 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", 24, true, Some("5"), Some(6), &[1, 2, 43, 65], (10, 11), [12, 13, 14], "15", "16", )); 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<'__f0, '__f1, '__f2, '__f3, '__f4>() -> BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4> { 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< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState = ( bon::private::Required<&'__f0 str>, bon::private::Required<u32>, bon::private::Required<bool>, bon::private::Optional<&'__f1 str>, bon::private::Optional<u32>, bon::private::Required<&'__f2 [u32]>, bon::private::Required<(u32, u32)>, bon::private::Required<[u32; 3]>, bon::private::Required<&'__f3 str>, bon::private::Required<&'__f4 str>, ), > { #[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<'__f0, '__f1, '__f2, '__f3, '__f4, __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< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState, > { _phantom: ::std::marker::PhantomData<( &'__f0 str, u32, bool, Option<&'__f1 str>, Option<u32>, &'__f2 [u32], (u32, u32), [u32; 3], &'__f3 str, &'__f4 str, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> where __State::Arg1: ::std::convert::Into<bon::private::Set<&'__f0 str>>, __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<&'__f1 str>>>, __State::Arg5: ::std::convert::Into<bon::private::Set<Option<u32>>>, __State::Arg6: ::std::convert::Into<bon::private::Set<&'__f2 [u32]>>, __State::Arg7: ::std::convert::Into<bon::private::Set<(u32, u32)>>, __State::Arg8: ::std::convert::Into<bon::private::Set<[u32; 3]>>, __State::Arg9: ::std::convert::Into<bon::private::Set<&'__f3 str>>, __State::Arg10: ::std::convert::Into<bon::private::Set<&'__f4 str>>, { #[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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( bon::private::Set<&'__f0 str>, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg1 = bon::private::Required<&'__f0 str>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { #[inline(always)] fn arg1( self, value: &'__f0 str, ) -> __BuilderBuilderSetArg1<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { BuilderBuilder { __private_impl: __BuilderBuilderPrivateImpl { _phantom: ::std::marker::PhantomData, arg1: bon::private::Set(value), 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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, bon::private::Set<u32>, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg2 = bon::private::Required<u32>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { #[inline(always)] fn arg2( self, value: u32, ) -> __BuilderBuilderSetArg2<'__f0, '__f1, '__f2, '__f3, '__f4, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, __State::Arg2, bon::private::Set<bool>, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg3 = bon::private::Required<bool>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { #[inline(always)] fn arg3( self, value: bool, ) -> __BuilderBuilderSetArg3<'__f0, '__f1, '__f2, '__f3, '__f4, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, __State::Arg2, __State::Arg3, bon::private::Set<Option<&'__f1 str>>, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg4 = bon::private::Optional<&'__f1 str>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __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<&'__f1 str>, ) -> __BuilderBuilderSetArg4<'__f0, '__f1, '__f2, '__f3, '__f4, __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), 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: &'__f1 str, ) -> __BuilderBuilderSetArg4<'__f0, '__f1, '__f2, '__f3, '__f4, __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)), 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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, bon::private::Set<Option<u32>>, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg5 = bon::private::Optional<u32>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, bon::private::Set<&'__f2 [u32]>, __State::Arg7, __State::Arg8, __State::Arg9, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg6 = bon::private::Required<&'__f2 [u32]>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { #[inline(always)] fn arg6( self, value: &'__f2 [u32], ) -> __BuilderBuilderSetArg6<'__f0, '__f1, '__f2, '__f3, '__f4, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, bon::private::Set<(u32, u32)>, __State::Arg8, __State::Arg9, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg7 = bon::private::Required<(u32, u32)>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { #[inline(always)] fn arg7( self, value: (u32, u32), ) -> __BuilderBuilderSetArg7<'__f0, '__f1, '__f2, '__f3, '__f4, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, bon::private::Set<[u32; 3]>, __State::Arg9, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg8 = bon::private::Required<[u32; 3]>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { #[inline(always)] fn arg8( self, value: [u32; 3], ) -> __BuilderBuilderSetArg8<'__f0, '__f1, '__f2, '__f3, '__f4, __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<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, bon::private::Set<&'__f3 str>, __State::Arg10, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg9 = bon::private::Required<&'__f3 str>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { #[inline(always)] fn arg9( self, value: &'__f3 str, ) -> __BuilderBuilderSetArg9<'__f0, '__f1, '__f2, '__f3, '__f4, __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), arg10: self.__private_impl.arg10, }, } } } #[allow(type_alias_bounds)] #[doc(hidden)] type __BuilderBuilderSetArg10<'__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState> = BuilderBuilder< '__f0, '__f1, '__f2, '__f3, '__f4, ( __State::Arg1, __State::Arg2, __State::Arg3, __State::Arg4, __State::Arg5, __State::Arg6, __State::Arg7, __State::Arg8, __State::Arg9, bon::private::Set<&'__f4 str>, ), >; impl< '__f0, '__f1, '__f2, '__f3, '__f4, __State: __BuilderBuilderState<Arg10 = bon::private::Required<&'__f4 str>>, > BuilderBuilder<'__f0, '__f1, '__f2, '__f3, '__f4, __State> { #[inline(always)] fn arg10( self, value: &'__f4 str, ) -> __BuilderBuilderSetArg10<'__f0, '__f1, '__f2, '__f3, '__f4, __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), }, } } } #[doc = "Positional function equivalent of [`builder()`].\nSee its docs for details."] #[allow(clippy::too_many_arguments)] fn regular( arg1: &str, arg2: u32, arg3: bool, arg4: Option<&str>, arg5: Option<u32>, arg6: &[u32], arg7: (u32, u32), arg8: [u32; 3], arg9: &str, arg10: &str, ) -> 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