mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Use fold() and write! macro instead of format!
This commit is contained in:
parent
dbe0a64d50
commit
37df657b87
1 changed files with 6 additions and 1 deletions
|
@ -9,6 +9,7 @@ use limbo_core::{Database, LimboError, OwnedValue, Statement, StepResult};
|
|||
use clap::{Parser, ValueEnum};
|
||||
use rustyline::DefaultEditor;
|
||||
use std::{
|
||||
fmt,
|
||||
io::{self, Write},
|
||||
path::PathBuf,
|
||||
rc::Rc,
|
||||
|
@ -310,7 +311,11 @@ impl<'a> Limbo<'a> {
|
|||
} else if value_type.contains("BLOB") {
|
||||
let blob = value.to_blob().unwrap_or(&[]);
|
||||
let hex_string: String =
|
||||
blob.iter().map(|b| format!("{:02x}", b)).collect();
|
||||
blob.iter().fold(String::new(), |mut output, b| {
|
||||
let _ =
|
||||
fmt::Write::write_fmt(&mut output, format_args!("{b:02x}"));
|
||||
output
|
||||
});
|
||||
format!("X'{}'", hex_string)
|
||||
} else {
|
||||
value.to_string()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue