content_scan 0.1.4

An extensible, plugin-based framework for identifying, analyzing, and recursively extracting structured content from arbitrary bytes.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[inline(always)]
pub(crate) fn get_file_name(path: &[u8]) -> &[u8] {
    if let Some(ofs) = path.iter().rposition(|&b| b == b'/' || b == b'\\') {
        &path[ofs + 1..]
    } else {
        path
    }
}

#[inline(always)]
pub(crate) fn get_extension(file_name: &[u8]) -> &[u8] {
    if let Some(ofs) = file_name.iter().rposition(|&b| b == b'.') {
        &file_name[ofs + 1..]
    } else {
        &[]
    }
}