Debian Codegraph @

src/delta.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::{selfrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/, BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#, IsTerminalrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/IsTerminal#, Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#};
4
5 use bytelinesrust-analyzer cargo bytelines 2.5.0 crate/::ByteLinesrust-analyzer cargo bytelines 2.5.0 std/ByteLines#;
6
7 use craterust-analyzer cargo git-delta 0.19.2 crate/::ansirust-analyzer cargo git-delta 0.19.2 ansi/;
8 use craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::delta_unreachablerust-analyzer cargo git-delta 0.19.2 config/delta_unreachable().;
9 use craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::Configrust-analyzer cargo git-delta 0.19.2 config/Config#;
10 use craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/::GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#;
11 use craterust-analyzer cargo git-delta 0.19.2 crate/::featuresrust-analyzer cargo git-delta 0.19.2 features/;
12 use craterust-analyzer cargo git-delta 0.19.2 crate/::handlersrust-analyzer cargo git-delta 0.19.2 handlers/::greprust-analyzer cargo git-delta 0.19.2 handlers/grep/;
13 use craterust-analyzer cargo git-delta 0.19.2 crate/::handlersrust-analyzer cargo git-delta 0.19.2 handlers/::hunk_headerrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/::{AmbiguousDiffMinusCounterrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/AmbiguousDiffMinusCounter#, ParsedHunkHeaderrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/ParsedHunkHeader#};
14 use craterust-analyzer cargo git-delta 0.19.2 crate/::handlersrust-analyzer cargo git-delta 0.19.2 handlers/::{selfrust-analyzer cargo git-delta 0.19.2 handlers/, merge_conflictrust-analyzer cargo git-delta 0.19.2 handlers/merge_conflict/};
15 use craterust-analyzer cargo git-delta 0.19.2 crate/::paintrust-analyzer cargo git-delta 0.19.2 paint/::Painterrust-analyzer cargo git-delta 0.19.2 paint/Painter#;
16 use craterust-analyzer cargo git-delta 0.19.2 crate/::stylerust-analyzer cargo git-delta 0.19.2 style/::DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#;
17 use craterust-analyzer cargo git-delta 0.19.2 crate/::utilsrust-analyzer cargo git-delta 0.19.2 utils/;
18
19 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
20 pub enum Staterust-analyzer cargo git-delta 0.19.2 delta/State# {
21 CommitMetarust-analyzer cargo git-delta 0.19.2 delta/State#CommitMeta#, // In commit metadata section
22 DiffHeaderrust-analyzer cargo git-delta 0.19.2 delta/State#DiffHeader#(DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#), // In diff metadata section, between (possible) commit metadata and first hunk
23 HunkHeaderrust-analyzer cargo git-delta 0.19.2 delta/State#HunkHeader#(DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#, ParsedHunkHeaderrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/ParsedHunkHeader#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), // In hunk metadata line (diff_type, parsed, line, raw_line)
24 HunkZerorust-analyzer cargo git-delta 0.19.2 delta/State#HunkZero#(DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>), // In hunk; unchanged line (prefix, raw_line)
25 HunkMinusrust-analyzer cargo git-delta 0.19.2 delta/State#HunkMinus#(DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>), // In hunk; removed line (diff_type, raw_line)
26 HunkPlusrust-analyzer cargo git-delta 0.19.2 delta/State#HunkPlus#(DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>), // In hunk; added line (diff_type, raw_line)
27 MergeConflictrust-analyzer cargo git-delta 0.19.2 delta/State#MergeConflict#(MergeParentsrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#, merge_conflictrust-analyzer cargo git-delta 0.19.2 handlers/merge_conflict/::MergeConflictCommitrust-analyzer cargo git-delta 0.19.2 handlers/merge_conflict/MergeConflictCommit#),
28 SubmoduleLogrust-analyzer cargo git-delta 0.19.2 delta/State#SubmoduleLog#, // In a submodule section, with gitconfig diff.submodule = log
29 SubmoduleShortrust-analyzer cargo git-delta 0.19.2 delta/State#SubmoduleShort#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), // In a submodule section, with gitconfig diff.submodule = short
30 Blamerust-analyzer cargo git-delta 0.19.2 delta/State#Blame#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), // In a line of `git blame` output (key).
31 GitShowFilerust-analyzer cargo git-delta 0.19.2 delta/State#GitShowFile#, // In a line of `git show $revision:./path/to/file.ext` output
32 Greprust-analyzer cargo git-delta 0.19.2 delta/State#Grep#(GrepTyperust-analyzer cargo git-delta 0.19.2 config/GrepType#, greprust-analyzer cargo git-delta 0.19.2 handlers/grep/::LineTyperust-analyzer cargo git-delta 0.19.2 handlers/grep/LineType#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>), // In a line of `git grep` output (grep_type, line_type, path, line_number)
33 Unknownrust-analyzer cargo git-delta 0.19.2 delta/State#Unknown#,
34 // The following elements are created when a line is wrapped to display it:
35 HunkZeroWrappedrust-analyzer cargo git-delta 0.19.2 delta/State#HunkZeroWrapped#, // Wrapped unchanged line
36 HunkMinusWrappedrust-analyzer cargo git-delta 0.19.2 delta/State#HunkMinusWrapped#, // Wrapped removed line
37 HunkPlusWrappedrust-analyzer cargo git-delta 0.19.2 delta/State#HunkPlusWrapped#, // Wrapped added line
38 }
39
40 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
41 pub enum DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType# {
42 Unifiedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Unified#,
43 // https://git-scm.com/docs/git-diff#_combined_diff_format
44 Combinedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Combined#(MergeParentsrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#, InMergeConflictrust-analyzer cargo git-delta 0.19.2 delta/InMergeConflict#),
45 }
46
47 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
48 pub enum MergeParentsrust-analyzer cargo git-delta 0.19.2 delta/MergeParents# {
49 Numberrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#Number#(usize), // Number of parent commits == (number of @s in hunk header) - 1
50 Prefixrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#Prefix#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), // Hunk line prefix, length == number of parent commits
51 Unknownrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#Unknown#,
52 }
53
54 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
55 pub enum InMergeConflictrust-analyzer cargo git-delta 0.19.2 delta/InMergeConflict# {
56 Yesrust-analyzer cargo git-delta 0.19.2 delta/InMergeConflict#Yes#,
57 Norust-analyzer cargo git-delta 0.19.2 delta/InMergeConflict#No#,
58 }
59
60 impl DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType# {
61 pub fn n_parentsrust-analyzer cargo git-delta 0.19.2 delta/impl#[DiffType]n_parents().(&self) -> usize {
62 use DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#::*;
63 use MergeParentsrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#::*;
64 match self {
65 Combinedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Combined#(Prefixrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#Prefix#(prefix), _) => prefix.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().(),
66 Combinedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Combined#(Numberrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#Number#(n_parents), _) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().n_parents,
67 Unifiedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Unified# => 1,
68 Combinedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Combined#(Unknownrust-analyzer cargo git-delta 0.19.2 delta/MergeParents#Unknown#, _) => delta_unreachablerust-analyzer cargo git-delta 0.19.2 config/delta_unreachable().("Number of merge parents must be known."),
69 }
70 }
71 }
72
73 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
74 pub enum Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source# {
75 GitDiffrust-analyzer cargo git-delta 0.19.2 delta/Source#GitDiff#, // Coming from a `git diff` command
76 DiffUnifiedrust-analyzer cargo git-delta 0.19.2 delta/Source#DiffUnified#, // Coming from a `diff -u` command
77 Unknownrust-analyzer cargo git-delta 0.19.2 delta/Source#Unknown#,
78 }
79
80 // Possible transitions, with actions on entry:
81 //
82 //
83 // | from \ to | CommitMeta | DiffHeader | HunkHeader | HunkZero | HunkMinus | HunkPlus |
84 // |-------------+-------------+-------------+-------------+-------------+-------------+----------|
85 // | CommitMeta | emit | emit | | | | |
86 // | DiffHeader | | emit | emit | | | |
87 // | HunkHeader | | | | emit | push | push |
88 // | HunkZero | emit | emit | emit | emit | push | push |
89 // | HunkMinus | flush, emit | flush, emit | flush, emit | flush, emit | push | push |
90 // | HunkPlus | flush, emit | flush, emit | flush, emit | flush, emit | flush, push | push |
91
92 pub struct StateMachinerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#<'a> {
93 pub linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
94 pub raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
95 pub staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state.: Staterust-analyzer cargo git-delta 0.19.2 delta/State#,
96 pub sourcerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#source.: Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source#,
97 pub minus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
98 pub plus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
99 pub minus_file_eventrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file_event.: handlersrust-analyzer cargo git-delta 0.19.2 handlers/::diff_headerrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/::FileEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#,
100 pub plus_file_eventrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file_event.: handlersrust-analyzer cargo git-delta 0.19.2 handlers/::diff_headerrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/::FileEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#,
101 pub diff_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#diff_line.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
102 pub mode_inforust-analyzer cargo git-delta 0.19.2 delta/StateMachine#mode_info.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
103 pub painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter.: Painterrust-analyzer cargo git-delta 0.19.2 paint/Painter#<'a>,
104 pub configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config.: &'a Configrust-analyzer cargo git-delta 0.19.2 config/Config#,
105
106 // When a file is modified, we use lines starting with '---' or '+++' to obtain the file name.
107 // When a file is renamed without changes, we use lines starting with 'rename' to obtain the
108 // file name (there is no diff hunk and hence no lines starting with '---' or '+++'). But when
109 // a file is renamed with changes, both are present, and we rely on the following variables to
110 // avoid emitting the file meta header line twice (#245).
111 pub current_file_pairrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#current_file_pair.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)>,
112 pub handled_diff_header_header_line_file_pairrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#handled_diff_header_header_line_file_pair.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)>,
113 pub blame_key_colorsrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#blame_key_colors.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
114 pub minus_line_counterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_line_counter.: AmbiguousDiffMinusCounterrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/AmbiguousDiffMinusCounter#,
115 }
116
117 pub fn deltarust-analyzer cargo git-delta 0.19.2 delta/delta().<I>(lines: ByteLinesrust-analyzer cargo bytelines 2.5.0 std/ByteLines#<I>, writer: &mut dyn Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#, config: &Configrust-analyzer cargo git-delta 0.19.2 config/Config#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>
118 where
119 I: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#,
120 {
121 StateMachinerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#::newrust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]new().(writer, config).consumerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]consume().(lines)
122 }
123
124 impl<'a> StateMachinerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#<'a> {
125 pub fn newrust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]new().(writer: &'a mut dyn Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#, config: &'a Configrust-analyzer cargo git-delta 0.19.2 config/Config#) -> Selfrust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`] {
126 Selfrust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`] {
127 linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line.: "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
128 raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line.: "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
129 staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state.: Staterust-analyzer cargo git-delta 0.19.2 delta/State#::Unknownrust-analyzer cargo git-delta 0.19.2 delta/State#Unknown#,
130 sourcerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#source.: Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source#::Unknownrust-analyzer cargo git-delta 0.19.2 delta/Source#Unknown#,
131 minus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file.: "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
132 plus_filerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file.: "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
133 minus_file_eventrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_file_event.: handlersrust-analyzer cargo git-delta 0.19.2 handlers/::diff_headerrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/::FileEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#::NoEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#NoEvent#,
134 plus_file_eventrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#plus_file_event.: handlersrust-analyzer cargo git-delta 0.19.2 handlers/::diff_headerrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/::FileEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#::NoEventrust-analyzer cargo git-delta 0.19.2 handlers/diff_header/FileEvent#NoEvent#,
135 diff_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#diff_line.: "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
136 mode_inforust-analyzer cargo git-delta 0.19.2 delta/StateMachine#mode_info.: "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
137 current_file_pairrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#current_file_pair.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
138 handled_diff_header_header_line_file_pairrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#handled_diff_header_header_line_file_pair.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
139 painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter.: Painterrust-analyzer cargo git-delta 0.19.2 paint/Painter#::newrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]new().(writer, config),
140 configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config.,
141 blame_key_colorsrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#blame_key_colors.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(),
142 minus_line_counterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_line_counter.: AmbiguousDiffMinusCounterrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/AmbiguousDiffMinusCounter#::not_neededrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/impl#[AmbiguousDiffMinusCounter]not_needed().(),
143 }
144 }
145
146 fn consumerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]consume().<I>(&mut self, mut lines: ByteLinesrust-analyzer cargo bytelines 2.5.0 std/ByteLines#<I>) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()>
147 where
148 I: BufReadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/BufRead#,
149 {
150 while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(raw_line_bytes)) = lines.nextrust-analyzer cargo bytelines 2.5.0 std/impl#[`ByteLines<B>`]next().() {
151 self.ingest_linerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]ingest_line().(raw_line_bytes);
152
153 if self.sourcerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#source. rust-analyzer cargo git-delta 0.19.2 delta/impl#[Source][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 delta/impl#[Source][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 delta/impl#[Source][`PartialEq<Self>`]eq().Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source#::Unknownrust-analyzer cargo git-delta 0.19.2 delta/Source#Unknown# {
154 self.sourcerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#source. = detect_sourcerust-analyzer cargo git-delta 0.19.2 delta/detect_source().(&self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line.);
155 // Handle (rare) plain `diff -u file1 file2` header. Done here to avoid having
156 // to introduce and handle a Source::DiffUnifiedAmbiguous variant everywhere.
157 if self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("--- ") {
158 self.minus_line_counterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#minus_line_counter. = AmbiguousDiffMinusCounterrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/AmbiguousDiffMinusCounter#::prepare_to_countrust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/impl#[AmbiguousDiffMinusCounter]prepare_to_count().();
159 }
160 }
161
162 // Every method named handle_* must return std::io::Result<bool>.
163 // The bool indicates whether the line has been handled by that
164 // method (in which case no subsequent handlers are permitted to
165 // handle it).
166 let _ = self.handle_commit_meta_header_linerust-analyzer cargo git-delta 0.19.2 handlers/commit_meta/impl#[`StateMachine<'_>`]handle_commit_meta_header_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
167 || self.handle_diff_stat_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_stat/impl#[`StateMachine<'_>`]handle_diff_stat_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
168 || self.handle_diff_header_diff_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header_diff/impl#[`StateMachine<'_>`]handle_diff_header_diff_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
169 || self.handle_diff_header_file_operation_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/impl#[`StateMachine<'_>`]handle_diff_header_file_operation_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
170 || self.handle_diff_header_minus_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/impl#[`StateMachine<'_>`]handle_diff_header_minus_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
171 || self.handle_diff_header_plus_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/impl#[`StateMachine<'_>`]handle_diff_header_plus_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
172 || self.handle_hunk_header_linerust-analyzer cargo git-delta 0.19.2 handlers/hunk_header/impl#[`StateMachine<'_>`]handle_hunk_header_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
173 || self.handle_diff_header_mode_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/impl#[`StateMachine<'_>`]handle_diff_header_mode_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
174 || self.handle_diff_header_misc_linerust-analyzer cargo git-delta 0.19.2 handlers/diff_header_misc/impl#[`StateMachine<'_>`]handle_diff_header_misc_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
175 || self.handle_submodule_log_linerust-analyzer cargo git-delta 0.19.2 handlers/submodule/impl#[`StateMachine<'_>`]handle_submodule_log_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
176 || self.handle_submodule_short_linerust-analyzer cargo git-delta 0.19.2 handlers/submodule/impl#[`StateMachine<'_>`]handle_submodule_short_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
177 || self.handle_merge_conflict_linerust-analyzer cargo git-delta 0.19.2 handlers/merge_conflict/impl#[`StateMachine<'_>`]handle_merge_conflict_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
178 || self.handle_hunk_linerust-analyzer cargo git-delta 0.19.2 handlers/hunk/impl#[`StateMachine<'_>`]handle_hunk_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
179 || self.handle_git_show_file_linerust-analyzer cargo git-delta 0.19.2 handlers/git_show_file/impl#[`StateMachine<'_>`]handle_git_show_file_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
180 || self.handle_blame_linerust-analyzer cargo git-delta 0.19.2 handlers/blame/impl#[`StateMachine<'_>`]handle_blame_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
181 || self.handle_grep_linerust-analyzer cargo git-delta 0.19.2 handlers/grep/impl#[`StateMachine<'_>`]handle_grep_line().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
182 || self.should_skip_linerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]should_skip_line().()
183 || self.emit_line_unchangedrust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]emit_line_unchanged().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
184 }
185
186 self.handle_pending_line_with_diff_namerust-analyzer cargo git-delta 0.19.2 handlers/diff_header/impl#[`StateMachine<'_>`]handle_pending_line_with_diff_name().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
187 self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..paint_buffered_minus_and_plus_linesrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]paint_buffered_minus_and_plus_lines().();
188 self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..emitrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]emit().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
189 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
190 }
191
192 fn ingest_linerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]ingest_line().(&mut self, raw_line_bytes: &[u8]) {
193 match Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8().(raw_line_bytes.to_vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]to_vec().()) {
194 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(utf8) => self.ingest_line_utf8rust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]ingest_line_utf8().(utf8),
195 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => {
196 let raw_line = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::from_utf8_lossyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]from_utf8_lossy().(raw_line_bytes);
197 let truncated_len = utilsrust-analyzer cargo git-delta 0.19.2 utils/::round_char_boundaryrust-analyzer cargo git-delta 0.19.2 utils/round_char_boundary/::floor_char_boundaryrust-analyzer cargo git-delta 0.19.2 utils/round_char_boundary/floor_char_boundary().(
198 &raw_line,
199 self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..max_line_lengthrust-analyzer cargo git-delta 0.19.2 config/Config#max_line_length.,
200 );
201 self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line. = raw_line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#truncated_len]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
202 self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line..clone_fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Clone]clone_from().(&self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line.);
203 }
204 }
205 }
206
207 fn ingest_line_utf8rust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]ingest_line_utf8().(&mut self, raw_line: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) {
208 self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line. = raw_line;
209 // When a file has \r\n line endings, git sometimes adds ANSI escape sequences between the
210 // \r and \n, in which case byte_lines does not remove the \r. Remove it now. [EndCRLF]
211 // TODO: Limit the number of characters we examine when looking for the \r?
212 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cr_index) = self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line..rfindrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]rfind().('\r') {
213 if ansirust-analyzer cargo git-delta 0.19.2 ansi/::measure_text_widthrust-analyzer cargo git-delta 0.19.2 ansi/measure_text_width().(&self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().cr_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 {
214 self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line. = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
215 "{}{}",
216 &self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...cr_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().,
217 &self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().cr_index +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1..]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().
218 );
219 }
220 }
221 if self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..max_line_lengthrust-analyzer cargo git-delta 0.19.2 config/Config#max_line_length. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0
222 && self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..max_line_lengthrust-analyzer cargo git-delta 0.19.2 config/Config#max_line_length.
223 // Do not truncate long hunk headers
224 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("@@")
225 // Do not truncate ripgrep --json output
226 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line..starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('{')
227 {
228 self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line. = ansirust-analyzer cargo git-delta 0.19.2 ansi/::truncate_strrust-analyzer cargo git-delta 0.19.2 ansi/truncate_str().(
229 &self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line.,
230 self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..max_line_lengthrust-analyzer cargo git-delta 0.19.2 config/Config#max_line_length.,
231 &self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..truncation_symbolrust-analyzer cargo git-delta 0.19.2 config/Config#truncation_symbol.,
232 )
233 .to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
234 };
235 self.linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#line. = ansirust-analyzer cargo git-delta 0.19.2 ansi/::strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line.);
236 }
237
238 /// Skip file metadata lines unless a raw diff style has been requested.
239 pub fn should_skip_linerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]should_skip_line().(&self) -> bool {
240 matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state., Staterust-analyzer cargo git-delta 0.19.2 delta/State#::DiffHeaderrust-analyzer cargo git-delta 0.19.2 delta/State#DiffHeader#(_))
241 && self.should_handlerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]should_handle().()
242 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..color_onlyrust-analyzer cargo git-delta 0.19.2 config/Config#color_only.
243 }
244
245 /// Emit unchanged any line that delta does not handle.
246 pub fn emit_line_unchangedrust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]emit_line_unchanged().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<bool> {
247 self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..emitrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]emit().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
248 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
249 self.painterrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#painter..writerrust-analyzer cargo git-delta 0.19.2 paint/Painter#writer.,
250 "{}",
251 format_raw_linerust-analyzer cargo git-delta 0.19.2 delta/format_raw_line().(&self.raw_linerust-analyzer cargo git-delta 0.19.2 delta/StateMachine#raw_line., self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config.)
252 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
253 let handled_line = true;
254 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(handled_line)
255 }
256
257 /// Should a handle_* function be called on this element?
258 // TODO: I'm not sure the above description is accurate; I think this
259 // function needs a more accurate name.
260 pub fn should_handlerust-analyzer cargo git-delta 0.19.2 delta/impl#[`StateMachine<'a>`]should_handle().(&self) -> bool {
261 let style = self.configrust-analyzer cargo git-delta 0.19.2 delta/StateMachine#config..get_stylerust-analyzer cargo git-delta 0.19.2 config/impl#[Config]get_style().(&self.staterust-analyzer cargo git-delta 0.19.2 delta/StateMachine#state.);
262 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().(style.is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw. && style.decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style. rust-analyzer cargo git-delta 0.19.2 style/impl#[DecorationStyle][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 style/impl#[DecorationStyle][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 style/impl#[DecorationStyle][`PartialEq<Self>`]eq().DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration#)
263 }
264 }
265
266 /// If output is going to a tty, emit hyperlinks if requested.
267 // Although raw output should basically be emitted unaltered, we do this.
268 pub fn format_raw_linerust-analyzer cargo git-delta 0.19.2 delta/format_raw_line().<'a>(line: &'a str, config: &Configrust-analyzer cargo git-delta 0.19.2 config/Config#) -> Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, str> {
269 if config.hyperlinksrust-analyzer cargo git-delta 0.19.2 config/Config#hyperlinks. && iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::stdoutrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/stdout().().is_terminalrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdout][IsTerminal]is_terminal().() {
270 featuresrust-analyzer cargo git-delta 0.19.2 features/::hyperlinksrust-analyzer cargo git-delta 0.19.2 features/hyperlinks/::format_commit_line_with_osc8_commit_hyperlinkrust-analyzer cargo git-delta 0.19.2 features/hyperlinks/format_commit_line_with_osc8_commit_hyperlink().(line, config)
271 } else {
272 Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[`Cow<'a, str>`][`From<&'a str>`]from().(line)
273 }
274 }
275
276 /// Try to detect what is producing the input for delta.
277 ///
278 /// Currently can detect:
279 /// * git diff
280 /// * diff -u
281 fn detect_sourcerust-analyzer cargo git-delta 0.19.2 delta/detect_source().(line: &str) -> Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source# {
282 if line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("commit ")
283 || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("diff --git ")
284 || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("diff --cc ")
285 || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("diff --combined ")
286 {
287 Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source#::GitDiffrust-analyzer cargo git-delta 0.19.2 delta/Source#GitDiff#
288 } else if line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("diff -u")
289 || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("diff -ru")
290 || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("diff -r -u")
291 || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("diff -U")
292 || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("--- ")
293 || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().("Only in ")
294 {
295 Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source#::DiffUnifiedrust-analyzer cargo git-delta 0.19.2 delta/Source#DiffUnified#
296 } else {
297 Sourcerust-analyzer cargo git-delta 0.19.2 delta/Source#::Unknownrust-analyzer cargo git-delta 0.19.2 delta/Source#Unknown#
298 }
299 }