Skip to content

Commit e5caa56

Browse files
Rename len method of ColsRef structs to width
1 parent d110b70 commit e5caa56

File tree

1 file changed

+6
-5
lines changed
  • crates/circuits/sha-macros/src

1 file changed

+6
-5
lines changed

crates/circuits/sha-macros/src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ fn make_struct(struct_info: StructInfo, config: &proc_macro2::Ident) -> proc_mac
178178
}
179179
}
180180

181-
pub fn len<C: #config>() -> usize {
181+
// returns number of cells in the struct (where each cell has type T)
182+
pub const fn width<C: #config>() -> usize {
182183
0 #( + #length_exprs )*
183184
}
184185
}
@@ -319,10 +320,10 @@ fn get_const_cols_ref_fields(
319320
#const_cols_ref_type
320321
},
321322
length_expr: quote! {
322-
<#const_cols_ref_type>::len::<C>()
323+
<#const_cols_ref_type>::width::<C>()
323324
},
324325
prepare_subslice: quote! {
325-
let #length_var = <#const_cols_ref_type>::len::<C>();
326+
let #length_var = <#const_cols_ref_type>::width::<C>();
326327
let (#slice_var, slice) = slice.split_at(#length_var);
327328
let #slice_var = <#const_cols_ref_type>::from::<C>(#slice_var);
328329
},
@@ -431,10 +432,10 @@ fn get_mut_cols_ref_fields(
431432
#mut_cols_ref_type
432433
},
433434
length_expr: quote! {
434-
<#mut_cols_ref_type>::len::<C>()
435+
<#mut_cols_ref_type>::width::<C>()
435436
},
436437
prepare_subslice: quote! {
437-
let #length_var = <#mut_cols_ref_type>::len::<C>();
438+
let #length_var = <#mut_cols_ref_type>::width::<C>();
438439
let (mut #slice_var, mut slice) = slice.split_at_mut(#length_var);
439440
let #slice_var = <#mut_cols_ref_type>::from::<C>(#slice_var);
440441
},

0 commit comments

Comments
 (0)