Sha256: ea87e9d11f5d0afce2aa25df89764e95ba21fdf5923cb4bded26d45115ef5e56

Contents?: true

Size: 398 Bytes

Versions: 2

Compression:

Stored size: 398 Bytes

Contents

use std::path::MAIN_SEPARATOR;
use libc::c_char;
use std::ffi::{CStr};
use std::str;

#[no_mangle]
pub extern fn is_relative(string: *const c_char) -> bool {
  let c_str = unsafe {
    assert!(!string.is_null());

    CStr::from_ptr(string)
  };

  let r_str = str::from_utf8(c_str.to_bytes()).unwrap_or("");

  r_str.chars().next().unwrap_or("muffins".chars().next().unwrap()) != MAIN_SEPARATOR
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
faster_path-0.1.7 src/is_relative.rs
faster_path-0.1.6 src/is_relative.rs