Function simics::api::simulator::python::_call_python_module_function

source ·
fn _call_python_module_function<S, I, T>(
    module: S,
    function: S,
    args: I,
) -> Result<AttrValue>
where S: AsRef<str>, I: IntoIterator<Item = T>, T: TryInto<AttrValue>,
Expand description

Call a python function with a set of arguments. The arguments must be convertible to AttrValue.

§Examples

We can run python code like so. If you need to pass a heterogeneous list of arguments, you need to convert them to AttrValues before passing them to this function because we cannot create a heterogeneous Vec. For homogeneous lists of arguments, they can be passed directly as in call_python_function.

let level: AttrValue = 1i32.into();
let sim: AttrValue = get_object("sim")?.into()?;
let group: AttrValue = 0i32.into();
let message: AttrValue = "Hello".into();
let res = call_python_module_function("simics", "SIM_log_info" [level, sim, group, message])?;