1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use { serde_json, string, util }; use libflo_error::{ Result as FuncResult, WrapErr }; use serialization::{ func, dynamic_event }; use static_libflo::{ STATIC_LIBFLO }; #[no_mangle] pub extern fn connect_nodes(arg: &str) -> FuncResult<()> { let libflo = STATIC_LIBFLO.get().wrap_err_to_err()?; let mut this = util::get_this_mut(&libflo).wrap_err_to_err()?; let this = util::cast_this_mut(&mut this).wrap_err_to_err()?; let arg = serde_json::from_str::<func::ConnectNodesArg>(arg).wrap_err_to_err()?; this.get_graph_mut().wrap_err_to_err()?.connect_nodes( arg.start_connector_index, arg.finish_connector_index ).wrap_err_to_err()?; let result = dynamic_event::ConnectNodesArg::new( arg.start_connector_index, arg.finish_connector_index ); libflo.send_event_by_module_name( string::self_module_name(), string::connect_nodes(), &result ).wrap_err_to_err() }