Skip to content

Commit fe14f48

Browse files
authored
Merge pull request #601 from Shnatsel/clone
Attack of the clones
2 parents 9475ea1 + 6305bd0 commit fe14f48

27 files changed

+86
-86
lines changed

cyclonedx-bom/src/external_models/date_time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use crate::validation::{
4040
///
4141
/// assert_eq!(date_time.to_string(), timestamp);
4242
/// ```
43-
#[derive(Debug, PartialEq, Eq)]
43+
#[derive(Clone, Debug, PartialEq, Eq)]
4444
pub struct DateTime(pub(crate) String);
4545

4646
impl DateTime {

cyclonedx-bom/src/external_models/normalized_string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::ops::Deref;
2525
/// A string that does not contain carriage return, line feed, or tab characters
2626
///
2727
/// Defined via the [XML schema](https://www.w3.org/TR/xmlschema-2/#normalizedString)
28-
#[derive(Debug, Default, PartialEq, Eq)]
28+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
2929
pub struct NormalizedString(pub(crate) String);
3030

3131
impl NormalizedString {

cyclonedx-bom/src/external_models/spdx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::validation::{FailureReason, Validate, ValidationResult};
3636
/// assert_eq!(spdx_identifier.to_string(), identifier);
3737
/// # Ok::<(), SpdxIdentifierError>(())
3838
/// ```
39-
#[derive(Debug, PartialEq, Eq)]
39+
#[derive(Clone, Debug, PartialEq, Eq)]
4040
pub struct SpdxIdentifier(pub(crate) String);
4141

4242
impl SpdxIdentifier {
@@ -119,7 +119,7 @@ pub enum SpdxIdentifierError {
119119
/// assert_eq!(spdx_expression.to_string(), expression);
120120
/// # Ok::<(), SpdxExpressionError>(())
121121
/// ```
122-
#[derive(Debug, PartialEq, Eq)]
122+
#[derive(Clone, Debug, PartialEq, Eq)]
123123
pub struct SpdxExpression(pub(crate) String);
124124

125125
impl SpdxExpression {

cyclonedx-bom/src/models/advisory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::validation::{
2424
/// Represents an advisory, a notification of a threat to a component, service, or system.
2525
///
2626
/// Defined via the [XML schema](https://cyclonedx.org/docs/1.4/xml/#type_advisoryType)
27-
#[derive(Debug, PartialEq, Eq)]
27+
#[derive(Clone, Debug, PartialEq, Eq)]
2828
pub struct Advisory {
2929
pub title: Option<NormalizedString>,
3030
pub url: Uri,
@@ -68,7 +68,7 @@ impl Validate for Advisory {
6868
}
6969
}
7070

71-
#[derive(Debug, PartialEq, Eq)]
71+
#[derive(Clone, Debug, PartialEq, Eq)]
7272
pub struct Advisories(pub Vec<Advisory>);
7373

7474
impl Validate for Advisories {

cyclonedx-bom/src/models/attached_text.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::{
2323
validation::{FailureReason, Validate, ValidationContext, ValidationError, ValidationResult},
2424
};
2525

26-
#[derive(Debug, PartialEq, Eq)]
26+
#[derive(Clone, Debug, PartialEq, Eq)]
2727
pub struct AttachedText {
2828
pub(crate) content_type: Option<NormalizedString>,
2929
pub(crate) encoding: Option<Encoding>,
@@ -86,7 +86,7 @@ impl Validate for AttachedText {
8686
}
8787
}
8888

89-
#[derive(Debug, PartialEq, Eq)]
89+
#[derive(Clone, Debug, PartialEq, Eq)]
9090
pub(crate) enum Encoding {
9191
Base64,
9292
#[doc(hidden)]

cyclonedx-bom/src/models/bom.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl ToString for SpecVersion {
7575
}
7676
}
7777

78-
#[derive(Debug, PartialEq, Eq)]
78+
#[derive(Clone, Debug, PartialEq, Eq)]
7979
pub struct Bom {
8080
pub version: u32,
8181
pub serial_number: Option<UrnUuid>,
@@ -510,7 +510,7 @@ fn validate_services(
510510
}
511511
}
512512

513-
#[derive(Debug, PartialEq, Eq)]
513+
#[derive(Clone, Debug, PartialEq, Eq)]
514514
pub struct UrnUuid(pub(crate) String);
515515

516516
impl UrnUuid {
@@ -558,7 +558,7 @@ impl Validate for UrnUuid {
558558
}
559559
}
560560

561-
#[derive(Debug, PartialEq, Eq)]
561+
#[derive(Clone, Debug, PartialEq, Eq)]
562562
pub enum UrnUuidError {
563563
InvalidUrnUuid(String),
564564
}

cyclonedx-bom/src/models/code.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use crate::{
2626

2727
use super::attached_text::AttachedText;
2828

29-
#[derive(Debug, PartialEq, Eq)]
29+
#[derive(Clone, Debug, PartialEq, Eq)]
3030
pub struct Commit {
3131
pub uid: Option<NormalizedString>,
3232
pub url: Option<Uri>,
@@ -78,7 +78,7 @@ impl Validate for Commit {
7878
}
7979
}
8080

81-
#[derive(Debug, PartialEq, Eq)]
81+
#[derive(Clone, Debug, PartialEq, Eq)]
8282
pub struct Commits(pub Vec<Commit>);
8383

8484
impl Validate for Commits {
@@ -100,7 +100,7 @@ impl Validate for Commits {
100100
}
101101
}
102102

103-
#[derive(Debug, PartialEq, Eq)]
103+
#[derive(Clone, Debug, PartialEq, Eq)]
104104
pub struct Diff {
105105
pub text: Option<AttachedText>,
106106
pub url: Option<Uri>,
@@ -131,7 +131,7 @@ impl Validate for Diff {
131131
}
132132
}
133133

134-
#[derive(Debug, PartialEq, Eq)]
134+
#[derive(Clone, Debug, PartialEq, Eq)]
135135
pub struct IdentifiableAction {
136136
pub timestamp: Option<DateTime>,
137137
pub name: Option<NormalizedString>,
@@ -170,7 +170,7 @@ impl Validate for IdentifiableAction {
170170
}
171171
}
172172

173-
#[derive(Debug, PartialEq, Eq)]
173+
#[derive(Clone, Debug, PartialEq, Eq)]
174174
pub struct Issue {
175175
pub issue_type: IssueClassification,
176176
pub id: Option<NormalizedString>,
@@ -234,7 +234,7 @@ impl Validate for Issue {
234234
}
235235
}
236236

237-
#[derive(Debug, PartialEq, Eq)]
237+
#[derive(Clone, Debug, PartialEq, Eq)]
238238
pub enum IssueClassification {
239239
Defect,
240240
Enhancement,
@@ -283,7 +283,7 @@ impl Validate for IssueClassification {
283283
}
284284
}
285285

286-
#[derive(Debug, PartialEq, Eq)]
286+
#[derive(Clone, Debug, PartialEq, Eq)]
287287
pub struct Patch {
288288
pub patch_type: PatchClassification,
289289
pub diff: Option<Diff>,
@@ -326,7 +326,7 @@ impl Validate for Patch {
326326
}
327327
}
328328

329-
#[derive(Debug, PartialEq, Eq)]
329+
#[derive(Clone, Debug, PartialEq, Eq)]
330330
pub struct Patches(pub Vec<Patch>);
331331

332332
impl Validate for Patches {
@@ -347,7 +347,7 @@ impl Validate for Patches {
347347
}
348348
}
349349

350-
#[derive(Debug, PartialEq, Eq)]
350+
#[derive(Clone, Debug, PartialEq, Eq)]
351351
pub enum PatchClassification {
352352
Unofficial,
353353
Monkey,
@@ -399,7 +399,7 @@ impl Validate for PatchClassification {
399399
}
400400
}
401401

402-
#[derive(Debug, PartialEq, Eq)]
402+
#[derive(Clone, Debug, PartialEq, Eq)]
403403
pub struct Source {
404404
pub name: Option<NormalizedString>,
405405
pub url: Option<Uri>,

cyclonedx-bom/src/models/component.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use crate::{
3838

3939
use super::signature::Signature;
4040

41-
#[derive(Debug, PartialEq, Eq)]
41+
#[derive(Clone, Debug, PartialEq, Eq)]
4242
pub struct Component {
4343
pub component_type: Classification,
4444
pub mime_type: Option<MimeType>,
@@ -243,7 +243,7 @@ impl Validate for Component {
243243
}
244244
}
245245

246-
#[derive(Debug, PartialEq, Eq)]
246+
#[derive(Clone, Debug, PartialEq, Eq)]
247247
pub struct Components(pub Vec<Component>);
248248

249249
impl Validate for Components {
@@ -264,7 +264,7 @@ impl Validate for Components {
264264
}
265265
}
266266

267-
#[derive(Debug, PartialEq, Eq)]
267+
#[derive(Clone, Debug, PartialEq, Eq)]
268268
pub enum Classification {
269269
Application,
270270
Framework,
@@ -328,7 +328,7 @@ impl Validate for Classification {
328328
}
329329
}
330330

331-
#[derive(Debug, PartialEq, Eq)]
331+
#[derive(Clone, Debug, PartialEq, Eq)]
332332
pub enum Scope {
333333
Required,
334334
Optional,
@@ -377,7 +377,7 @@ impl Validate for Scope {
377377
}
378378
}
379379

380-
#[derive(Debug, PartialEq, Eq)]
380+
#[derive(Clone, Debug, PartialEq, Eq)]
381381
pub struct MimeType(pub(crate) String);
382382

383383
impl Validate for MimeType {
@@ -406,7 +406,7 @@ impl Validate for MimeType {
406406
}
407407
}
408408

409-
#[derive(Debug, PartialEq, Eq)]
409+
#[derive(Clone, Debug, PartialEq, Eq)]
410410
pub struct Swid {
411411
pub tag_id: String,
412412
pub name: String,
@@ -442,7 +442,7 @@ impl Validate for Swid {
442442
}
443443
}
444444

445-
#[derive(Debug, PartialEq, Eq)]
445+
#[derive(Clone, Debug, PartialEq, Eq)]
446446
pub struct Cpe(pub(crate) String);
447447

448448
impl FromStr for Cpe {
@@ -484,7 +484,7 @@ impl Validate for Cpe {
484484
}
485485
}
486486

487-
#[derive(Debug, PartialEq, Eq)]
487+
#[derive(Clone, Debug, PartialEq, Eq)]
488488
pub struct ComponentEvidence {
489489
pub licenses: Option<Licenses>,
490490
pub copyright: Option<CopyrightTexts>,
@@ -516,7 +516,7 @@ impl Validate for ComponentEvidence {
516516
}
517517
}
518518

519-
#[derive(Debug, PartialEq, Eq)]
519+
#[derive(Clone, Debug, PartialEq, Eq)]
520520
pub struct Pedigree {
521521
pub ancestors: Option<Components>,
522522
pub descendants: Option<Components>,
@@ -569,7 +569,7 @@ impl Validate for Pedigree {
569569
}
570570
}
571571

572-
#[derive(Debug, PartialEq, Eq)]
572+
#[derive(Clone, Debug, PartialEq, Eq)]
573573
pub struct Copyright(pub String);
574574

575575
impl Validate for Copyright {
@@ -581,7 +581,7 @@ impl Validate for Copyright {
581581
}
582582
}
583583

584-
#[derive(Debug, PartialEq, Eq)]
584+
#[derive(Clone, Debug, PartialEq, Eq)]
585585
pub struct CopyrightTexts(pub(crate) Vec<Copyright>);
586586

587587
impl Validate for CopyrightTexts {

cyclonedx-bom/src/models/composition.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::validation::{
2323

2424
use super::signature::Signature;
2525

26-
#[derive(Debug, PartialEq, Eq)]
26+
#[derive(Clone, Debug, PartialEq, Eq)]
2727
pub struct Composition {
2828
pub aggregate: AggregateType,
2929
pub assemblies: Option<Vec<BomReference>>,
@@ -49,7 +49,7 @@ impl Validate for Composition {
4949
}
5050
}
5151

52-
#[derive(Debug, PartialEq, Eq)]
52+
#[derive(Clone, Debug, PartialEq, Eq)]
5353
pub struct Compositions(pub Vec<Composition>);
5454

5555
impl Validate for Compositions {
@@ -71,7 +71,7 @@ impl Validate for Compositions {
7171
}
7272
}
7373

74-
#[derive(Debug, PartialEq, Eq)]
74+
#[derive(Clone, Debug, PartialEq, Eq)]
7575
pub enum AggregateType {
7676
Complete,
7777
Incomplete,
@@ -129,7 +129,7 @@ impl Validate for AggregateType {
129129
}
130130
}
131131

132-
#[derive(Debug, PartialEq, Eq)]
132+
#[derive(Clone, Debug, PartialEq, Eq)]
133133
pub struct BomReference(pub(crate) String);
134134

135135
#[cfg(test)]

cyclonedx-bom/src/models/dependency.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
* SPDX-License-Identifier: Apache-2.0
1717
*/
1818

19-
#[derive(Debug, PartialEq, Eq)]
19+
#[derive(Clone, Debug, PartialEq, Eq)]
2020
pub struct Dependencies(pub Vec<Dependency>);
2121

22-
#[derive(Debug, PartialEq, Eq)]
22+
#[derive(Clone, Debug, PartialEq, Eq)]
2323
pub struct Dependency {
2424
pub dependency_ref: String,
2525
pub dependencies: Vec<String>,

0 commit comments

Comments
 (0)