@@ -102,15 +102,15 @@ fn asc_type_derive_struct(item_struct: ItemStruct) -> TokenStream {
102102 // that contains both versions (each in a variant), and that increased
103103 // the memory size, so that's why we use less than.
104104 if asc_obj. len( ) < std:: mem:: size_of:: <Self >( ) {
105- return Err ( graph:: runtime:: DeterministicHostError ( graph:: prelude:: anyhow:: anyhow!( "Size does not match" ) ) ) ;
105+ return Err ( graph:: runtime:: DeterministicHostError :: from ( graph:: prelude:: anyhow:: anyhow!( "Size does not match" ) ) ) ;
106106 }
107107 }
108108 _ => {
109109 let content_size = std:: mem:: size_of:: <Self >( ) ;
110110 let aligned_size = graph:: runtime:: padding_to_16( content_size) ;
111111
112112 if graph:: runtime:: HEADER_SIZE + asc_obj. len( ) == aligned_size + content_size {
113- return Err ( graph:: runtime:: DeterministicHostError ( graph:: prelude:: anyhow:: anyhow!( "Size does not match" ) ) ) ;
113+ return Err ( graph:: runtime:: DeterministicHostError :: from ( graph:: prelude:: anyhow:: anyhow!( "Size does not match" ) ) ) ;
114114 }
115115 } ,
116116 } ;
@@ -120,7 +120,7 @@ fn asc_type_derive_struct(item_struct: ItemStruct) -> TokenStream {
120120 #(
121121 let field_size = std:: mem:: size_of:: <#field_types>( ) ;
122122 let field_data = asc_obj. get( offset..( offset + field_size) ) . ok_or_else( || {
123- graph:: runtime:: DeterministicHostError ( graph:: prelude:: anyhow:: anyhow!( "Attempted to read past end of array" ) )
123+ graph:: runtime:: DeterministicHostError :: from ( graph:: prelude:: anyhow:: anyhow!( "Attempted to read past end of array" ) )
124124 } ) ?;
125125 let #field_names2 = graph:: runtime:: AscType :: from_asc_bytes( & field_data, api_version) ?;
126126 offset += field_size;
@@ -163,7 +163,7 @@ fn asc_type_derive_struct(item_struct: ItemStruct) -> TokenStream {
163163// fn from_asc_bytes(asc_obj: &[u8], _api_version: graph::semver::Version) -> Result<Self, graph::runtime::DeterministicHostError> {
164164// let mut u32_bytes: [u8; size_of::<u32>()] = [0; size_of::<u32>()];
165165// if std::mem::size_of_val(&u32_bytes) != std::mem::size_of_val(&asc_obj) {
166- // return Err(graph::runtime::DeterministicHostError(graph::prelude::anyhow::anyhow!("Invalid asc bytes size")));
166+ // return Err(graph::runtime::DeterministicHostError::from (graph::prelude::anyhow::anyhow!("Invalid asc bytes size")));
167167// }
168168// u32_bytes.copy_from_slice(&asc_obj);
169169// let discr = u32::from_le_bytes(u32_bytes);
@@ -174,7 +174,7 @@ fn asc_type_derive_struct(item_struct: ItemStruct) -> TokenStream {
174174// 3u32 => JsonValueKind::String,
175175// 4u32 => JsonValueKind::Array,
176176// 5u32 => JsonValueKind::Object,
177- // _ => Err(graph::runtime::DeterministicHostError(graph::prelude::anyhow::anyhow!("value {} is out of range for {}", discr, "JsonValueKind"))),
177+ // _ => Err(graph::runtime::DeterministicHostError::from (graph::prelude::anyhow::anyhow!("value {} is out of range for {}", discr, "JsonValueKind"))),
178178// }
179179// }
180180// }
@@ -206,11 +206,11 @@ fn asc_type_derive_enum(item_enum: ItemEnum) -> TokenStream {
206206
207207 fn from_asc_bytes( asc_obj: & [ u8 ] , _api_version: & graph:: semver:: Version ) -> Result <Self , graph:: runtime:: DeterministicHostError > {
208208 let u32_bytes = :: std:: convert:: TryFrom :: try_from( asc_obj)
209- . map_err( |_| graph:: runtime:: DeterministicHostError ( graph:: prelude:: anyhow:: anyhow!( "Invalid asc bytes size" ) ) ) ?;
209+ . map_err( |_| graph:: runtime:: DeterministicHostError :: from ( graph:: prelude:: anyhow:: anyhow!( "Invalid asc bytes size" ) ) ) ?;
210210 let discr = u32 :: from_le_bytes( u32_bytes) ;
211211 match discr {
212212 #( #variant_discriminant2 => Ok ( #enum_name_iter2:: #variant_paths2) , ) *
213- _ => Err ( graph:: runtime:: DeterministicHostError ( graph:: prelude:: anyhow:: anyhow!( "value {} is out of range for {}" , discr, stringify!( #enum_name) ) ) )
213+ _ => Err ( graph:: runtime:: DeterministicHostError :: from ( graph:: prelude:: anyhow:: anyhow!( "value {} is out of range for {}" , discr, stringify!( #enum_name) ) ) )
214214 }
215215 }
216216 }
0 commit comments