#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct Insets {
pub top: f32,
pub bottom: f32,
pub left: f32,
pub right: f32,
}
#[cfg(target_os = "ios")]
pub fn insets() -> Insets {
unsafe extern "C" {
fn platform_safe_top() -> f32;
fn platform_safe_bottom() -> f32;
fn platform_safe_left() -> f32;
fn platform_safe_right() -> f32;
}
unsafe {
Insets {
top: platform_safe_top(),
bottom: platform_safe_bottom(),
left: platform_safe_left(),
right: platform_safe_right(),
}
}
}
#[cfg(not(target_os = "ios"))]
pub fn insets() -> Insets {
Insets::default()
}
#[cfg(target_os = "ios")]
pub fn top() -> f32 {
unsafe extern "C" {
fn platform_safe_top() -> f32;
}
unsafe { platform_safe_top() }
}
#[cfg(not(target_os = "ios"))]
pub fn top() -> f32 {
0.0
}