Skip to main content

classify_fallback

Function classify_fallback 

Source
pub fn classify_fallback(buffer: &[u8]) -> &'static str
Expand description

The label of the crate-private classify result: the text/data fallback described in the module doc.

Returns one of "empty", "ASCII text", "Unicode text, UTF-8 text", "ISO-8859 text", "Non-ISO extended-ASCII text", or "data".

ยงExamples

use libmagic_rs::output::ascmagic::classify_fallback;

assert_eq!(classify_fallback(b""), "empty");
assert_eq!(classify_fallback(b"hello world\n"), "ASCII text");
assert_eq!(classify_fallback(&[0x00, 0x01, 0x02, 0xff]), "data");