feat(preset-env/base): Implement more traits for BrowserData and Version (#5879)

**Description:**

This derives additional common traits for these public structs.
This commit is contained in:
Will Binns-Smith 2022-09-15 18:04:13 -07:00 committed by GitHub
parent 52c17f3056
commit 73c48a8e6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@
//! something usable. //! something usable.
use anyhow::Error; use anyhow::Error;
use serde::Deserialize; use serde::{Deserialize, Serialize};
use st_map::StaticMap; use st_map::StaticMap;
use self::version::Version; use self::version::Version;
@ -13,7 +13,7 @@ pub mod query;
pub mod version; pub mod version;
/// A map without allocation. /// A map without allocation.
#[derive(Debug, Default, Deserialize, Clone, Copy, StaticMap)] #[derive(Debug, Default, Deserialize, Clone, Copy, Serialize, StaticMap, PartialEq, Eq)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct BrowserData<T: Default> { pub struct BrowserData<T: Default> {
#[serde(default)] #[serde(default)]

View File

@ -2,7 +2,7 @@
use std::{cmp, cmp::Ordering, fmt, str::FromStr}; use std::{cmp, cmp::Ordering, fmt, str::FromStr};
use serde::{de, de::Visitor, Deserialize, Deserializer}; use serde::{de, de::Visitor, Deserialize, Deserializer, Serialize};
use tracing::warn; use tracing::warn;
use crate::Versions; use crate::Versions;
@ -11,7 +11,7 @@ use crate::Versions;
/// ///
/// This is similar to semver, but this assumes a production build. (No tag like /// This is similar to semver, but this assumes a production build. (No tag like
/// `alpha`) /// `alpha`)
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize)]
pub struct Version { pub struct Version {
/// `a` in `a.b.c` /// `a` in `a.b.c`
pub major: u32, pub major: u32,