Sha256: 7f1aeddd9714cb977a1d8bf68c19c960b6f9a287438320c23e424bad94f9abf5

Contents?: true

Size: 418 Bytes

Versions: 1

Compression:

Stored size: 418 Bytes

Contents

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


#[no_mangle]
pub extern fn is_absolute(string: *const c_char) -> bool {
  let c_str = unsafe {
    if string.is_null() {
      return false;
    }
    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

1 entries across 1 versions & 1 rubygems

Version Path
faster_path-0.1.8 src/is_absolute.rs