#![allow(clippy::inline_always)]
use crate::repr::LeanCtorObjectRepr;
use crate::types::{b_lean_obj_arg, b_lean_obj_res, lean_obj_arg, lean_obj_res, lean_object};
unsafe extern "C" {
pub fn lean_io_mark_end_initialization();
}
#[inline(always)]
unsafe fn ctor_get0(r: b_lean_obj_arg) -> *mut lean_object {
unsafe {
let ctor = r.cast::<LeanCtorObjectRepr>();
*(*ctor).objs.as_ptr()
}
}
#[inline(always)]
pub unsafe fn lean_io_result_is_ok(r: b_lean_obj_arg) -> bool {
unsafe { crate::object::lean_ptr_tag(r) == 0 }
}
#[inline(always)]
pub unsafe fn lean_io_result_is_error(r: b_lean_obj_arg) -> bool {
unsafe { crate::object::lean_ptr_tag(r) == 1 }
}
#[inline(always)]
pub unsafe fn lean_io_result_get_value(r: b_lean_obj_arg) -> b_lean_obj_res {
unsafe { ctor_get0(r) }
}
#[inline(always)]
pub unsafe fn lean_io_result_get_error(r: b_lean_obj_arg) -> b_lean_obj_res {
unsafe { ctor_get0(r) }
}
#[inline(always)]
pub unsafe fn lean_io_result_take_value(r: lean_obj_arg) -> lean_obj_res {
unsafe {
let v = ctor_get0(r);
crate::refcount::lean_inc(v);
crate::refcount::lean_dec(r);
v
}
}