mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
perf(mysql): guarantee no allocation if no columns are passed to Row::deserialize_with
This commit is contained in:
parent
4cbdac6884
commit
ad6d4b5740
@ -12,6 +12,10 @@ pub(crate) struct Row {
|
||||
|
||||
impl<'de> Deserialize<'de, &'de [ColumnDefinition]> for Row {
|
||||
fn deserialize_with(mut buf: Bytes, columns: &'de [ColumnDefinition]) -> Result<Self> {
|
||||
if columns.is_empty() {
|
||||
return Ok(Self { values: vec![] });
|
||||
}
|
||||
|
||||
let mut values = Vec::with_capacity(columns.len());
|
||||
|
||||
for _ in columns {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user