@@ -147,6 +147,7 @@ impl AllTypes for Contract {
147147 fn test_string ( v : String ) -> String {
148148 v
149149 }
150+ /// Custom env param docs.
150151 fn test_env_param ( _env : & Env ) -> u32 {
151152 100
152153 }
@@ -157,63 +158,6 @@ impl AllTypes for Contract {
157158 }
158159 }
159160}
160- #[ doc( hidden) ]
161- #[ allow( non_snake_case) ]
162- pub mod __Contract__test_u32__spec {
163- #[ doc( hidden) ]
164- #[ allow( non_snake_case) ]
165- #[ allow( non_upper_case_globals) ]
166- pub static __SPEC_XDR_FN_TEST_U32: [ u8 ; 48usize ] = super :: Contract :: spec_xdr_test_u32 ( ) ;
167- }
168- impl Contract {
169- #[ allow( non_snake_case) ]
170- pub const fn spec_xdr_test_u32 ( ) -> [ u8 ; 48usize ] {
171- * b"\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \x08 test_u32\0 \0 \0 \x01 \0 \0 \0 \0 \0 \0 \0 \x01 v\0 \0 \0 \0 \0 \0 \x04 \0 \0 \0 \x01 \0 \0 \0 \x04 "
172- }
173- }
174- #[ doc( hidden) ]
175- #[ allow( non_snake_case) ]
176- pub mod __Contract__test_string__spec {
177- #[ doc( hidden) ]
178- #[ allow( non_snake_case) ]
179- #[ allow( non_upper_case_globals) ]
180- pub static __SPEC_XDR_FN_TEST_STRING: [ u8 ; 52usize ] = super :: Contract :: spec_xdr_test_string ( ) ;
181- }
182- impl Contract {
183- #[ allow( non_snake_case) ]
184- pub const fn spec_xdr_test_string ( ) -> [ u8 ; 52usize ] {
185- * b"\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \x0b test_string\0 \0 \0 \0 \x01 \0 \0 \0 \0 \0 \0 \0 \x01 v\0 \0 \0 \0 \0 \0 \x10 \0 \0 \0 \x01 \0 \0 \0 \x10 "
186- }
187- }
188- #[ doc( hidden) ]
189- #[ allow( non_snake_case) ]
190- pub mod __Contract__test_env_param__spec {
191- #[ doc( hidden) ]
192- #[ allow( non_snake_case) ]
193- #[ allow( non_upper_case_globals) ]
194- pub static __SPEC_XDR_FN_TEST_ENV_PARAM: [ u8 ; 40usize ] =
195- super :: Contract :: spec_xdr_test_env_param ( ) ;
196- }
197- impl Contract {
198- #[ allow( non_snake_case) ]
199- pub const fn spec_xdr_test_env_param ( ) -> [ u8 ; 40usize ] {
200- * b"\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \x0e test_env_param\0 \0 \0 \0 \0 \0 \0 \0 \0 \x01 \0 \0 \0 \x04 "
201- }
202- }
203- #[ doc( hidden) ]
204- #[ allow( non_snake_case) ]
205- pub mod __Contract__test_struct__spec {
206- #[ doc( hidden) ]
207- #[ allow( non_snake_case) ]
208- #[ allow( non_upper_case_globals) ]
209- pub static __SPEC_XDR_FN_TEST_STRUCT: [ u8 ; 76usize ] = super :: Contract :: spec_xdr_test_struct ( ) ;
210- }
211- impl Contract {
212- #[ allow( non_snake_case) ]
213- pub const fn spec_xdr_test_struct ( ) -> [ u8 ; 76usize ] {
214- * b"\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \x0b test_struct\0 \0 \0 \0 \x01 \0 \0 \0 \0 \0 \0 \0 \x01 v\0 \0 \0 \0 \0 \x07 \xd0 \0 \0 \0 \x08 MyStruct\0 \0 \0 \x01 \0 \0 \x07 \xd0 \0 \0 \0 \x08 MyStruct"
215- }
216- }
217161impl < ' a > ContractClient < ' a > {
218162 pub fn test_u32 ( & self , v : & u32 ) -> u32 {
219163 use core:: ops:: Not ;
@@ -370,6 +314,7 @@ impl<'a> ContractClient<'a> {
370314 }
371315 res
372316 }
317+ /// Custom env param docs.
373318 pub fn test_env_param ( & self ) -> u32 {
374319 use core:: ops:: Not ;
375320 let old_auth_manager = self
@@ -403,6 +348,7 @@ impl<'a> ContractClient<'a> {
403348 }
404349 res
405350 }
351+ /// Custom env param docs.
406352 pub fn try_test_env_param (
407353 & self ,
408354 ) -> Result <
@@ -636,6 +582,7 @@ pub extern "C" fn __Contract__test_string__invoke_raw_extern(
636582 __Contract__test_string__invoke_raw ( soroban_sdk:: Env :: default ( ) , arg_0)
637583}
638584#[ doc( hidden) ]
585+ /// Custom env param docs.
639586#[ allow( non_snake_case) ]
640587#[ deprecated( note = "use `ContractClient::new(&env, &contract_id).test_env_param` instead" ) ]
641588#[ allow( deprecated) ]
@@ -646,6 +593,7 @@ pub fn __Contract__test_env_param__invoke_raw(env: soroban_sdk::Env) -> soroban_
646593 )
647594}
648595#[ doc( hidden) ]
596+ /// Custom env param docs.
649597#[ allow( non_snake_case) ]
650598#[ deprecated( note = "use `ContractClient::new(&env, &contract_id).test_env_param` instead" ) ]
651599pub fn __Contract__test_env_param__invoke_raw_slice (
@@ -665,6 +613,7 @@ pub fn __Contract__test_env_param__invoke_raw_slice(
665613 __Contract__test_env_param__invoke_raw ( env)
666614}
667615#[ doc( hidden) ]
616+ /// Custom env param docs.
668617#[ allow( non_snake_case) ]
669618#[ deprecated( note = "use `ContractClient::new(&env, &contract_id).test_env_param` instead" ) ]
670619pub extern "C" fn __Contract__test_env_param__invoke_raw_extern ( ) -> soroban_sdk:: Val {
@@ -3463,6 +3412,72 @@ fn __Contract__AllTypes__447a3d427d821f62365afd21ac9b6fa9597c9d71324b5cba7631f73
34633412 }
34643413}
34653414#[ doc( hidden) ]
3415+ /// Test u32 values.
3416+ /// Returns the input unchanged.
3417+ #[ allow( non_snake_case) ]
3418+ pub mod __Contract__test_u32__spec {
3419+ #[ doc( hidden) ]
3420+ #[ allow( non_snake_case) ]
3421+ #[ allow( non_upper_case_globals) ]
3422+ /// Test u32 values.
3423+ /// Returns the input unchanged.
3424+ pub static __SPEC_XDR_FN_TEST_U32: [ u8 ; 96usize ] = super :: Contract :: spec_xdr_test_u32 ( ) ;
3425+ }
3426+ impl Contract {
3427+ #[ allow( non_snake_case) ]
3428+ /// Test u32 values.
3429+ /// Returns the input unchanged.
3430+ pub const fn spec_xdr_test_u32 ( ) -> [ u8 ; 96usize ] {
3431+ * b"\0 \0 \0 \0 \0 \0 \0 -Test u32 values.\n Returns the input unchanged.\0 \0 \0 \0 \0 \0 \x08 test_u32\0 \0 \0 \x01 \0 \0 \0 \0 \0 \0 \0 \x01 v\0 \0 \0 \0 \0 \0 \x04 \0 \0 \0 \x01 \0 \0 \0 \x04 "
3432+ }
3433+ }
3434+ #[ doc( hidden) ]
3435+ #[ allow( non_snake_case) ]
3436+ pub mod __Contract__test_string__spec {
3437+ #[ doc( hidden) ]
3438+ #[ allow( non_snake_case) ]
3439+ #[ allow( non_upper_case_globals) ]
3440+ pub static __SPEC_XDR_FN_TEST_STRING: [ u8 ; 52usize ] = super :: Contract :: spec_xdr_test_string ( ) ;
3441+ }
3442+ impl Contract {
3443+ #[ allow( non_snake_case) ]
3444+ pub const fn spec_xdr_test_string ( ) -> [ u8 ; 52usize ] {
3445+ * b"\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \x0b test_string\0 \0 \0 \0 \x01 \0 \0 \0 \0 \0 \0 \0 \x01 v\0 \0 \0 \0 \0 \0 \x10 \0 \0 \0 \x01 \0 \0 \0 \x10 "
3446+ }
3447+ }
3448+ #[ doc( hidden) ]
3449+ /// Custom env param docs.
3450+ #[ allow( non_snake_case) ]
3451+ pub mod __Contract__test_env_param__spec {
3452+ #[ doc( hidden) ]
3453+ #[ allow( non_snake_case) ]
3454+ #[ allow( non_upper_case_globals) ]
3455+ /// Custom env param docs.
3456+ pub static __SPEC_XDR_FN_TEST_ENV_PARAM: [ u8 ; 64usize ] =
3457+ super :: Contract :: spec_xdr_test_env_param ( ) ;
3458+ }
3459+ impl Contract {
3460+ #[ allow( non_snake_case) ]
3461+ /// Custom env param docs.
3462+ pub const fn spec_xdr_test_env_param ( ) -> [ u8 ; 64usize ] {
3463+ * b"\0 \0 \0 \0 \0 \0 \0 \x16 Custom env param docs.\0 \0 \0 \0 \0 \x0e test_env_param\0 \0 \0 \0 \0 \0 \0 \0 \0 \x01 \0 \0 \0 \x04 "
3464+ }
3465+ }
3466+ #[ doc( hidden) ]
3467+ #[ allow( non_snake_case) ]
3468+ pub mod __Contract__test_struct__spec {
3469+ #[ doc( hidden) ]
3470+ #[ allow( non_snake_case) ]
3471+ #[ allow( non_upper_case_globals) ]
3472+ pub static __SPEC_XDR_FN_TEST_STRUCT: [ u8 ; 76usize ] = super :: Contract :: spec_xdr_test_struct ( ) ;
3473+ }
3474+ impl Contract {
3475+ #[ allow( non_snake_case) ]
3476+ pub const fn spec_xdr_test_struct ( ) -> [ u8 ; 76usize ] {
3477+ * b"\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \x0b test_struct\0 \0 \0 \0 \x01 \0 \0 \0 \0 \0 \0 \0 \x01 v\0 \0 \0 \0 \0 \x07 \xd0 \0 \0 \0 \x08 MyStruct\0 \0 \0 \x01 \0 \0 \x07 \xd0 \0 \0 \0 \x08 MyStruct"
3478+ }
3479+ }
3480+ #[ doc( hidden) ]
34663481#[ allow( non_snake_case) ]
34673482#[ allow( unused) ]
34683483fn __Contract__AllTypes__1eb9a6a69c5f732bd78e03e0fa5ea9d0a5c925757f7a5e53cd10ccd57b3e027d_ctor ( ) {
@@ -3511,6 +3526,117 @@ mod test {
35113526 use super :: * ;
35123527 use soroban_sdk:: { map, symbol_short, testutils:: Address as _, vec, Env } ;
35133528 extern crate test;
3529+ #[ rustc_test_marker = "test::test_spec_docs_inherited_from_trait" ]
3530+ #[ doc( hidden) ]
3531+ pub const test_spec_docs_inherited_from_trait: test:: TestDescAndFn = test:: TestDescAndFn {
3532+ desc : test:: TestDesc {
3533+ name : test:: StaticTestName ( "test::test_spec_docs_inherited_from_trait" ) ,
3534+ ignore : false ,
3535+ ignore_message : :: core:: option:: Option :: None ,
3536+ source_file : "tests/contracttrait_impl_partial/src/lib.rs" ,
3537+ start_line : 42usize ,
3538+ start_col : 8usize ,
3539+ end_line : 42usize ,
3540+ end_col : 43usize ,
3541+ compile_fail : false ,
3542+ no_run : false ,
3543+ should_panic : test:: ShouldPanic :: No ,
3544+ test_type : test:: TestType :: UnitTest ,
3545+ } ,
3546+ testfn : test:: StaticTestFn (
3547+ #[ coverage( off) ]
3548+ || test:: assert_test_result ( test_spec_docs_inherited_from_trait ( ) ) ,
3549+ ) ,
3550+ } ;
3551+ fn test_spec_docs_inherited_from_trait ( ) {
3552+ use stellar_xdr:: curr as stellar_xdr;
3553+ use stellar_xdr:: { Limits , ReadXdr , ScSpecEntry } ;
3554+ let entry = ScSpecEntry :: from_xdr ( Contract :: spec_xdr_test_u32 ( ) , Limits :: none ( ) ) . unwrap ( ) ;
3555+ let ScSpecEntry :: FunctionV0 ( func) = entry else {
3556+ {
3557+ :: core:: panicking:: panic_fmt ( format_args ! ( "expected FunctionV0" ) ) ;
3558+ } ;
3559+ } ;
3560+ match (
3561+ & func. doc . to_utf8_string ( ) . unwrap ( ) ,
3562+ & "Test u32 values.\n Returns the input unchanged." ,
3563+ ) {
3564+ ( left_val, right_val) => {
3565+ if !( * left_val == * right_val) {
3566+ let kind = :: core:: panicking:: AssertKind :: Eq ;
3567+ :: core:: panicking:: assert_failed (
3568+ kind,
3569+ & * left_val,
3570+ & * right_val,
3571+ :: core:: option:: Option :: None ,
3572+ ) ;
3573+ }
3574+ }
3575+ } ;
3576+ let entry = ScSpecEntry :: from_xdr ( Contract :: spec_xdr_test_i32 ( ) , Limits :: none ( ) ) . unwrap ( ) ;
3577+ let ScSpecEntry :: FunctionV0 ( func) = entry else {
3578+ {
3579+ :: core:: panicking:: panic_fmt ( format_args ! ( "expected FunctionV0" ) ) ;
3580+ } ;
3581+ } ;
3582+ match ( & func. doc . to_utf8_string ( ) . unwrap ( ) , & "Test i32 values." ) {
3583+ ( left_val, right_val) => {
3584+ if !( * left_val == * right_val) {
3585+ let kind = :: core:: panicking:: AssertKind :: Eq ;
3586+ :: core:: panicking:: assert_failed (
3587+ kind,
3588+ & * left_val,
3589+ & * right_val,
3590+ :: core:: option:: Option :: None ,
3591+ ) ;
3592+ }
3593+ }
3594+ } ;
3595+ let entry =
3596+ ScSpecEntry :: from_xdr ( Contract :: spec_xdr_test_string ( ) , Limits :: none ( ) ) . unwrap ( ) ;
3597+ let ScSpecEntry :: FunctionV0 ( func) = entry else {
3598+ {
3599+ :: core:: panicking:: panic_fmt ( format_args ! ( "expected FunctionV0" ) ) ;
3600+ } ;
3601+ } ;
3602+ match ( & func. doc . to_utf8_string ( ) . unwrap ( ) , & "" ) {
3603+ ( left_val, right_val) => {
3604+ if !( * left_val == * right_val) {
3605+ let kind = :: core:: panicking:: AssertKind :: Eq ;
3606+ :: core:: panicking:: assert_failed (
3607+ kind,
3608+ & * left_val,
3609+ & * right_val,
3610+ :: core:: option:: Option :: None ,
3611+ ) ;
3612+ }
3613+ }
3614+ } ;
3615+ let entry =
3616+ ScSpecEntry :: from_xdr ( Contract :: spec_xdr_test_env_param ( ) , Limits :: none ( ) ) . unwrap ( ) ;
3617+ let ScSpecEntry :: FunctionV0 ( func) = entry else {
3618+ {
3619+ :: core:: panicking:: panic_fmt ( format_args ! ( "expected FunctionV0" ) ) ;
3620+ } ;
3621+ } ;
3622+ match (
3623+ & func. doc . to_utf8_string ( ) . unwrap ( ) ,
3624+ & "Custom env param docs." ,
3625+ ) {
3626+ ( left_val, right_val) => {
3627+ if !( * left_val == * right_val) {
3628+ let kind = :: core:: panicking:: AssertKind :: Eq ;
3629+ :: core:: panicking:: assert_failed (
3630+ kind,
3631+ & * left_val,
3632+ & * right_val,
3633+ :: core:: option:: Option :: None ,
3634+ ) ;
3635+ }
3636+ }
3637+ } ;
3638+ }
3639+ extern crate test;
35143640 #[ rustc_test_marker = "test::test_partial_override" ]
35153641 #[ doc( hidden) ]
35163642 pub const test_partial_override: test:: TestDescAndFn = test:: TestDescAndFn {
@@ -3519,9 +3645,9 @@ mod test {
35193645 ignore : false ,
35203646 ignore_message : :: core:: option:: Option :: None ,
35213647 source_file : "tests/contracttrait_impl_partial/src/lib.rs" ,
3522- start_line : 41usize ,
3648+ start_line : 83usize ,
35233649 start_col : 8usize ,
3524- end_line : 41usize ,
3650+ end_line : 83usize ,
35253651 end_col : 29usize ,
35263652 compile_fail : false ,
35273653 no_run : false ,
@@ -3847,5 +3973,5 @@ mod test {
38473973#[ doc( hidden) ]
38483974pub fn main ( ) -> ( ) {
38493975 extern crate test;
3850- test:: test_main_static ( & [ & test_partial_override] )
3976+ test:: test_main_static ( & [ & test_partial_override, & test_spec_docs_inherited_from_trait ] )
38513977}
0 commit comments