gix_validate/lib.rs
1//! Validation for various kinds of git related items.
2//!
3//! Errors expose a classification-only [`gix_error::ClassificationMarker`] source.
4//! Use [`gix_error::classify()`] or `is_validation()` on [`gix_error::Exn`] and [`gix_error::Error`] to check the
5//! classification, without depending on the concrete diagnostic type. The concrete validation
6//! error remains available for downcasting and probable-cause selection.
7//!
8//! ## Examples
9//!
10//! ```
11//! use bstr::ByteSlice;
12//!
13//! assert!(gix_validate::reference::name(b"refs/heads/main".as_bstr()).is_ok());
14//! assert!(gix_validate::tag::name(b"v1.2.3".as_bstr()).is_ok());
15//! assert!(gix_validate::submodule::name(b"vendor/package".as_bstr()).is_ok());
16//!
17//! assert!(gix_validate::path::component(b"src".as_bstr(), None, Default::default()).is_ok());
18//! assert!(gix_validate::path::component(b".git".as_bstr(), None, Default::default()).is_err());
19//! ```
20#![deny(missing_docs)]
21#![forbid(unsafe_code)]
22
23///
24pub mod reference;
25
26///
27pub mod tag;
28
29///
30pub mod submodule;
31
32///
33pub mod path;