MCPcopy Create free account
hub / github.com/astonbitecode/j4rs / make_primitive

Method make_primitive

rust/src/api/invocation_arg.rs:162–189  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

160 }
161
162 fn make_primitive(&mut self) -> errors::Result<()> {
163 match utils::primitive_of(self) {
164 Some(primitive_repr) => {
165 match *self {
166 InvocationArg::Java {
167 instance: _,
168 ref mut class_name,
169 serialized: _,
170 } => *class_name = primitive_repr,
171 InvocationArg::Rust {
172 json: _,
173 ref mut class_name,
174 serialized: _,
175 } => *class_name = primitive_repr,
176 InvocationArg::RustBasic {
177 instance: _,
178 ref mut class_name,
179 serialized: _,
180 } => *class_name = primitive_repr,
181 };
182 Ok(())
183 }
184 None => Err(errors::J4RsError::JavaError(format!(
185 "Cannot transform to primitive: {}",
186 utils::get_class_name(self)
187 ))),
188 }
189 }
190
191 /// Consumes this InvocationArg and transforms it to an InvocationArg that contains a Java primitive, leveraging Java's autoboxing.
192 ///

Callers 1

into_primitiveMethod · 0.80

Calls 1

primitive_ofFunction · 0.85

Tested by

no test coverage detected