gix_merge/blob/builtin_driver/
mod.rs

1use crate::blob::BuiltinDriver;
2
3impl BuiltinDriver {
4    /// Return the name of this instance.
5    pub fn as_str(&self) -> &str {
6        match self {
7            BuiltinDriver::Text => "text",
8            BuiltinDriver::Binary => "binary",
9            BuiltinDriver::Union => "union",
10        }
11    }
12
13    /// Get all available built-in drivers.
14    pub fn all() -> &'static [Self] {
15        &[BuiltinDriver::Text, BuiltinDriver::Binary, BuiltinDriver::Union]
16    }
17
18    /// Try to match one of our variants to `name`, case-sensitive, and return its instance.
19    pub fn by_name(name: &str) -> Option<Self> {
20        Self::all().iter().find(|variant| variant.as_str() == name).copied()
21    }
22}
23
24///
25pub mod binary;
26pub use binary::function::merge as binary;
27
28///
29pub mod text;
30pub use text::function::merge as text;