Method
end
(&mut self, ctx: Ctx<'_>, buffer: Opt<ArrayBufferView<'_>>)
Source from the content-addressed store, hash-verified
| 237 | } |
| 238 | |
| 239 | pub fn end(&mut self, ctx: Ctx<'_>, buffer: Opt<ArrayBufferView<'_>>) -> Result<String> { |
| 240 | let output = if let Some(data) = buffer.0.as_ref().and_then(|b| b.as_bytes()) { |
| 241 | Some(self.decode_data(&ctx, data)?) |
| 242 | } else { |
| 243 | None |
| 244 | }; |
| 245 | |
| 246 | let flush = self.flush(&ctx)?; |
| 247 | Ok(output |
| 248 | .map(|mut o| { |
| 249 | o.push_str(&flush); |
| 250 | o |
| 251 | }) |
| 252 | .unwrap_or(flush)) |
| 253 | } |
| 254 | |
| 255 | pub fn write(&mut self, ctx: Ctx<'_>, buffer: ArrayBufferView<'_>) -> Result<String> { |
| 256 | let data = buffer |