MCPcopy Index your code
hub / github.com/RustPython/RustPython / length

Method length

crates/stdlib/src/hashlib.rs:165–172  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

163 const MAX_SHAKE_OUTPUT_LENGTH: usize = 1 << 29;
164
165 fn length(&self, vm: &VirtualMachine) -> PyResult<usize> {
166 let length = usize::try_from(self.length)
167 .map_err(|_| vm.new_value_error("length must be non-negative"))?;
168 if length >= Self::MAX_SHAKE_OUTPUT_LENGTH {
169 return Err(vm.new_value_error("length is too large"));
170 }
171 Ok(length)
172 }
173 }
174
175 #[derive(FromArgs)]

Callers 5

bisect_leftFunction · 0.45
bisect_rightFunction · 0.45
digestMethod · 0.45
hexdigestMethod · 0.45

Calls 1

ErrClass · 0.50

Tested by

no test coverage detected