MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / to_i32

Method to_i32

ciphercore-base/src/data_values.rs:553–555  ·  view source on GitHub ↗

Converts `self` to a scalar if it is a byte vector, then casts the result to `i32`. # Arguments `st` - scalar type used to interpret `self` # Result Resulting scalar cast to `i32` # Examples ``` # use ciphercore_base::data_values::Value; # use ciphercore_base::data_types::INT32; let v = Value::from_scalar(-123456, INT32).unwrap(); assert_eq!(v.to_i32(INT32).unwrap(), -123456i32 as i32); ```

(&self, st: ScalarType)

Source from the content-addressed store, hash-verified

551 /// assert_eq!(v.to_i32(INT32).unwrap(), -123456i32 as i32);
552 /// ```
553 pub fn to_i32(&self, st: ScalarType) -> Result<i32> {
554 Ok(self.to_u128(st)? as i32)
555 }
556
557 /// Converts `self` to a scalar if it is a byte vector, then casts the result to `u64`.
558 ///

Callers 3

test_secret_sharingFunction · 0.80
test_named_contextsFunction · 0.80
test_secret_sharingFunction · 0.80

Calls 1

to_u128Method · 0.45

Tested by 3

test_secret_sharingFunction · 0.64
test_named_contextsFunction · 0.64
test_secret_sharingFunction · 0.64