From db1fd8f129208bab9887531075f684a873f2128a Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Sat, 09 May 2026 00:26:26 +0000 Subject: [PATCH] refactor: consistent *32 method naming --- --- a/crates/jrsonnet-evaluator/src/arr/spec.rs +++ b/crates/jrsonnet-evaluator/src/arr/spec.rs @@ -34,23 +34,23 @@ } } trait ArrayCheap { - fn get(&self, index: u32) -> Option; - fn len(&self) -> u32; + fn get32(&self, index: u32) -> Option; + fn len32(&self) -> u32; } impl ArrayLike for T where T: Any + Trace + Debug + ArrayCheap, { fn len32(&self) -> u32 { - ::len(self) + ::len32(self) } fn get32(&self, index: u32) -> Result> { - Ok(::get(self, index)) + Ok(::get32(self, index)) } fn get_lazy32(&self, index: u32) -> Option> { - ::get(self, index).map(Thunk::evaluated) + ::get32(self, index).map(Thunk::evaluated) } fn is_cheap(&self) -> bool { @@ -59,10 +59,10 @@ } impl ArrayCheap for () { - fn len(&self) -> u32 { + fn len32(&self) -> u32 { 0 } - fn get(&self, _index: u32) -> Option { + fn get32(&self, _index: u32) -> Option { None } } @@ -99,10 +99,10 @@ } impl ArrayCheap for IBytes { - fn len(&self) -> u32 { + fn len32(&self) -> u32 { arridx(self.as_slice().len()) } - fn get(&self, index: u32) -> Option { + fn get32(&self, index: u32) -> Option { self.as_slice() .get(index as usize) .map(|v| Val::Num((*v).into())) @@ -110,13 +110,13 @@ } impl ArrayCheap for Rc> { - fn get(&self, index: u32) -> Option { + fn get32(&self, index: u32) -> Option { self.as_slice() .get(index as usize) .map(|tv| tv.clone().into()) } - fn len(&self) -> u32 { + fn len32(&self) -> u32 { arridx(self.as_slice().len()) } } @@ -353,10 +353,10 @@ } } impl ArrayCheap for RangeArray { - fn get(&self, index: u32) -> Option { + fn get32(&self, index: u32) -> Option { self.range().nth(index as usize).map(|i| Val::Num(i.into())) } - fn len(&self) -> u32 { + fn len32(&self) -> u32 { self.size() } } -- gitstuff