#![deny(missing_docs, rust_2018_idioms)]
#![forbid(unsafe_code)]
use bitflags::bitflags;
use bstr::BString;
pub mod parse;
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
pub struct Pattern {
pub path: BString,
pub signature: MagicSignature,
pub search_mode: MatchMode,
pub attributes: Vec<git_attributes::Assignment>,
}
bitflags! {
pub struct MagicSignature: u32 {
const TOP = 1 << 0;
const ICASE = 1 << 1;
const EXCLUDE = 1 << 2;
}
}
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
pub enum MatchMode {
ShellGlob,
Literal,
PathAwareGlob,
}
impl Default for MatchMode {
fn default() -> Self {
MatchMode::ShellGlob
}
}
pub fn parse(input: &[u8]) -> Result<Pattern, parse::Error> {
Pattern::from_bytes(input)
}