Sha256: ae324ff5bc19b8290653ed4ee14d48962997f903f0cdebdd3fcd0ff1915d0192

Contents?: true

Size: 344 Bytes

Versions: 4

Compression:

Stored size: 344 Bytes

Contents

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


#[no_mangle]
pub extern fn is_absolute(path: *const c_char) -> bool {
  if path.is_null() {
    return false;
  }
  let r_str = unsafe { CStr::from_ptr(path) }.to_str().unwrap();

  match r_str.chars().next() {
    Some(c) => c == MAIN_SEPARATOR,
    None => false
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
faster_path-0.1.13 src/is_absolute.rs
faster_path-0.1.12 src/is_absolute.rs
faster_path-0.1.11 src/is_absolute.rs
faster_path-0.1.10 src/is_absolute.rs