Sha256: dbee0dda855c4bf2071cf8e4e9571f208acb1d0cc697a7a87526860029cbdd7c
Contents?: true
Size: 396 Bytes
Versions: 4
Compression:
Stored size: 396 Bytes
Contents
#[no_mangle] pub extern fn basename(string: *const c_char) -> *const c_char { let c_str = unsafe { assert!(!string.is_null()); CStr::from_ptr(string) }; let r_str = str::from_utf8(c_str.to_bytes()).unwrap(); let part = Path::new(r_str).file_name().unwrap_or(OsStr::new("")).to_str(); let output = CString::new(format!("{}", part.unwrap())).unwrap(); output.into_raw() }
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
faster_path-0.1.1 | src/basename.rs |
faster_path-0.1.0 | src/basename.rs |
faster_path-0.0.9 | src/basename.rs |
faster_path-0.0.8 | src/basename.rs |