MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / from_constant

Method from_constant

src/oomir.rs:952–968  ·  view source on GitHub ↗

Create a Type from a Constant.

(constant: &Constant)

Source from the content-addressed store, hash-verified

950 }
951 }
952
953 pub fn is_zero(&self) -> bool {
954 match self {
955 Constant::I8(i) => *i == 0,
956 Constant::I16(i) => *i == 0,
957 Constant::I32(i) => *i == 0,
958 Constant::I64(i) => *i == 0,
959 Constant::F32(f) => *f == 0.0,
960 Constant::F64(f) => *f == 0.0,
961 Constant::Char(c) => *c == '\0',
962 Constant::Boolean(b) => !*b,
963 _ => false, // Null, String, Array, etc. are not zero
964 }
965 }
966
967 pub fn is_one(&self) -> bool {
968 match self {
969 Constant::I8(i) => *i == 1,
970 Constant::I16(i) => *i == 1,
971 Constant::I32(i) => *i == 1,

Callers

nothing calls this directly

Calls 1

to_stringMethod · 0.80

Tested by

no test coverage detected