Skip to content

Commit 3d3dc2e

Browse files
Rename len method of ColsRef structs to width
1 parent 0d61762 commit 3d3dc2e

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
@@ -180,7 +180,8 @@ fn make_struct(struct_info: StructInfo, config: &proc_macro2::Ident) -> proc_mac
180180
}
181181
}
182182

183-
pub fn len<C: #config>() -> usize {
183+
// returns number of cells in the struct (where each cell has type T)
184+
pub const fn width<C: #config>() -> usize {
184185
0 #( + #length_exprs )*
185186
}
186187
}
@@ -321,10 +322,10 @@ fn get_const_cols_ref_fields(
321322
#const_cols_ref_type
322323
},
323324
length_expr: quote! {
324-
<#const_cols_ref_type>::len::<C>()
325+
<#const_cols_ref_type>::width::<C>()
325326
},
326327
prepare_subslice: quote! {
327-
let #length_var = <#const_cols_ref_type>::len::<C>();
328+
let #length_var = <#const_cols_ref_type>::width::<C>();
328329
let (#slice_var, slice) = slice.split_at(#length_var);
329330
let #slice_var = <#const_cols_ref_type>::from::<C>(#slice_var);
330331
},
@@ -433,10 +434,10 @@ fn get_mut_cols_ref_fields(
433434
#mut_cols_ref_type
434435
},
435436
length_expr: quote! {
436-
<#mut_cols_ref_type>::len::<C>()
437+
<#mut_cols_ref_type>::width::<C>()
437438
},
438439
prepare_subslice: quote! {
439-
let #length_var = <#mut_cols_ref_type>::len::<C>();
440+
let #length_var = <#mut_cols_ref_type>::width::<C>();
440441
let (mut #slice_var, mut slice) = slice.split_at_mut(#length_var);
441442
let #slice_var = <#mut_cols_ref_type>::from::<C>(#slice_var);
442443
},

0 commit comments

Comments
 (0)