mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Cleanups for future script crate split (#35987)
* script: Avoid direct impl blocks on generated dicts and unions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Remove references to codegen-specific import module. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
3ecd1c0699
commit
d35da38a2f
43 changed files with 211 additions and 146 deletions
|
@ -49,6 +49,7 @@ pub(crate) struct SecurityPolicyViolationReport {
|
|||
line_number: u32,
|
||||
column_number: u32,
|
||||
original_policy: String,
|
||||
#[serde(serialize_with = "serialize_disposition")]
|
||||
disposition: SecurityPolicyViolationEventDisposition,
|
||||
}
|
||||
|
||||
|
@ -170,11 +171,12 @@ impl Convert<SecurityPolicyViolationEventInit> for SecurityPolicyViolationReport
|
|||
}
|
||||
}
|
||||
|
||||
impl Serialize for SecurityPolicyViolationEventDisposition {
|
||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
match self {
|
||||
Self::Report => serializer.serialize_str("report"),
|
||||
Self::Enforce => serializer.serialize_str("enforce"),
|
||||
}
|
||||
fn serialize_disposition<S: serde::Serializer>(
|
||||
val: &SecurityPolicyViolationEventDisposition,
|
||||
serializer: S,
|
||||
) -> Result<S::Ok, S::Error> {
|
||||
match val {
|
||||
SecurityPolicyViolationEventDisposition::Report => serializer.serialize_str("report"),
|
||||
SecurityPolicyViolationEventDisposition::Enforce => serializer.serialize_str("enforce"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue