(&mut self, line: &LineOps)
| 146 | Ok(()) |
| 147 | } |
| 148 | fn line(&mut self, line: &LineOps) -> FormatResult<()> { |
| 149 | self.branch(line.branch_id()); |
| 150 | for (n, col, state) in [ |
| 151 | ( |
| 152 | line.old_line_num(), |
| 153 | &mut self.c.old_numbers, |
| 154 | &mut self.s.old_number, |
| 155 | ), |
| 156 | ( |
| 157 | line.new_line_num(), |
| 158 | &mut self.c.new_numbers, |
| 159 | &mut self.s.new_number, |
| 160 | ), |
| 161 | ] { |
| 162 | put(&mut self.c.control, u64::from(n.is_some())); |
| 163 | if let Some(n) = n { |
| 164 | state.write(col, n as u64); |
| 165 | } |
| 166 | } |
| 167 | put( |
| 168 | &mut self.c.control, |
| 169 | u64::from(line.content_range().is_some()), |
| 170 | ); |
| 171 | if let Some((a, b)) = line.content_range() { |
| 172 | self.s.position.write(&mut self.c.positions, a.get()); |
| 173 | self.s.position.write(&mut self.c.positions, b.get()); |
| 174 | } |
| 175 | match line.operation() { |
| 176 | BranchOp::Insert { after, content } => { |
| 177 | put(&mut self.c.control, 0); |
| 178 | self.optional_branch(*after); |
| 179 | self.leaves(content, line.content_range())?; |
| 180 | } |
| 181 | BranchOp::Delete { branch, content } => { |
| 182 | put(&mut self.c.control, 1); |
| 183 | self.branch(*branch); |
| 184 | self.leaves(content, None)?; |
| 185 | } |
| 186 | BranchOp::Modify { |
| 187 | branch, |
| 188 | old_content, |
| 189 | new_content, |
| 190 | } => { |
| 191 | put(&mut self.c.control, 2); |
| 192 | self.branch(*branch); |
| 193 | self.leaves(old_content, None)?; |
| 194 | self.leaves(new_content, line.content_range())?; |
| 195 | } |
| 196 | BranchOp::Restore { branch } => { |
| 197 | put(&mut self.c.control, 3); |
| 198 | self.branch(*branch); |
| 199 | } |
| 200 | BranchOp::Reparent { branch, new_after } => { |
| 201 | put(&mut self.c.control, 4); |
| 202 | self.branch(*branch); |
| 203 | self.optional_branch(*new_after); |
| 204 | } |
| 205 | } |
no test coverage detected