mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 18:54:05 +02:00
use array match syntax for Color::deserialize
This commit is contained in:
parent
009628aecc
commit
9fb038e777
1 changed files with 2 additions and 6 deletions
|
|
@ -217,13 +217,9 @@ impl<'de> Deserialize<'de> for Color {
|
|||
D: Deserializer<'de>,
|
||||
{
|
||||
let str = <&str>::deserialize(deserializer)?;
|
||||
let colors = <[u8; 3]>::parse(str)
|
||||
let [r, g, b] = <[u8; 3]>::parse(str)
|
||||
.map_err(|_| D::Error::invalid_value(Unexpected::Other(str), &"a list of 3 numbers"))?;
|
||||
Ok(Color {
|
||||
r: colors[0],
|
||||
g: colors[1],
|
||||
b: colors[2],
|
||||
})
|
||||
Ok(Color { r, g, b })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue