(argv: *const u32, argc: u32, out: *mut u32)
| 162 | #[unsafe(no_mangle)] |
| 163 | #[allow(clippy::not_unsafe_ptr_arg_deref)] |
| 164 | pub extern "C" fn r#match(argv: *const u32, argc: u32, out: *mut u32) -> i32 { |
| 165 | if argc != 3 { |
| 166 | __internals::stash_error(Error::Type(alloc::format!("match expects 2 positional args, got {}", argc - 1))); |
| 167 | return 1; |
| 168 | } |
| 169 | let pattern = match String::from_handle(unsafe { *argv.add(0) }) { |
| 170 | Ok(v) => v, |
| 171 | Err(e) => { __internals::stash_error(e); return 1; } |
| 172 | }; |
| 173 | let string = match String::from_handle(unsafe { *argv.add(1) }) { |
| 174 | Ok(v) => v, |
| 175 | Err(e) => { __internals::stash_error(e); return 1; } |
| 176 | }; |
| 177 | let value = match main::find(&pattern, &string, Mode::Match) { |
| 178 | Ok(v) => v.map(|f| f.text), |
| 179 | Err(e) => { __internals::stash_error(to_error(e)); return 1; } |
| 180 | }; |
| 181 | match IntoValue::into_handle(value) { |
| 182 | Ok(h) => { unsafe { *out = h.into_raw(); } 0 } |
| 183 | Err(e) => { __internals::stash_error(e); 1 } |
| 184 | } |
| 185 | } |
| 186 | } |
nothing calls this directly
no test coverage detected