pub struct DiffHandlersConfig {
pub handler: Vec<HandlerRule>,
}Expand description
Configuration for external diff handlers loaded from .ta/diff-handlers.toml.
Fields§
§handler: Vec<HandlerRule>List of handler rules, evaluated in order.
Implementations§
Source§impl DiffHandlersConfig
impl DiffHandlersConfig
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self, DiffHandlerError>
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, DiffHandlerError>
Load diff-handlers config from a TOML file.
Returns a default (empty) config if the file doesn’t exist.
Sourcepub fn load_from_project<P: AsRef<Path>>(
project_root: P,
) -> Result<Self, DiffHandlerError>
pub fn load_from_project<P: AsRef<Path>>( project_root: P, ) -> Result<Self, DiffHandlerError>
Load config from the standard location (.ta/diff-handlers.toml in project root).
Sourcepub fn find_handler(&self, file_path: &str) -> Option<&HandlerRule>
pub fn find_handler(&self, file_path: &str) -> Option<&HandlerRule>
Find the first handler matching the given file path.
Sourcepub fn open_file<P: AsRef<Path>>(
&self,
file_path: P,
fallback_to_os_default: bool,
) -> Result<(), DiffHandlerError>
pub fn open_file<P: AsRef<Path>>( &self, file_path: P, fallback_to_os_default: bool, ) -> Result<(), DiffHandlerError>
Open a file with the configured handler, or use OS default if no handler matches.
- If a handler is configured for the file pattern, use it.
- Otherwise, fall back to OS default (
openon macOS,xdg-openon Linux).
Trait Implementations§
Source§impl Clone for DiffHandlersConfig
impl Clone for DiffHandlersConfig
Source§fn clone(&self) -> DiffHandlersConfig
fn clone(&self) -> DiffHandlersConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DiffHandlersConfig
impl Debug for DiffHandlersConfig
Source§impl Default for DiffHandlersConfig
impl Default for DiffHandlersConfig
Source§fn default() -> DiffHandlersConfig
fn default() -> DiffHandlersConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DiffHandlersConfig
impl<'de> Deserialize<'de> for DiffHandlersConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for DiffHandlersConfig
impl RefUnwindSafe for DiffHandlersConfig
impl Send for DiffHandlersConfig
impl Sync for DiffHandlersConfig
impl Unpin for DiffHandlersConfig
impl UnsafeUnpin for DiffHandlersConfig
impl UnwindSafe for DiffHandlersConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more