-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test data records and drop impl fragments
- Loading branch information
Showing
8 changed files
with
520 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,47 @@ | ||
use super::fragment::FragmentGenerator; | ||
use super::fragment::{ | ||
data_records::DataRecordsGenerator, drop_impl::DropImplGenerator, | ||
from_previous_record_data_records::FromPreviousRecordDataRecordsGenerator, | ||
from_previous_record_impls::FromPreviousRecordImplsGenerator, | ||
from_unpacked_record_impls::FromUnpackedRecordImplsGenerator, record::RecordGenerator, | ||
record_impl::RecordImplGenerator, FragmentGenerator, | ||
}; | ||
|
||
#[derive(Default)] | ||
pub struct GeneratorConfig { | ||
pub custom_fragment_generators: Vec<Box<dyn FragmentGenerator>>, | ||
pub(crate) fragment_generators: Vec<Box<dyn FragmentGenerator>>, | ||
} | ||
|
||
impl GeneratorConfig { | ||
fn common_fragment_generators() -> [Box<dyn FragmentGenerator>; 7] { | ||
[ | ||
Box::new(DataRecordsGenerator), | ||
Box::new(RecordGenerator), | ||
Box::new(RecordImplGenerator), | ||
Box::new(DropImplGenerator), | ||
Box::new(FromUnpackedRecordImplsGenerator), | ||
Box::new(FromPreviousRecordDataRecordsGenerator), | ||
Box::new(FromPreviousRecordImplsGenerator), | ||
] | ||
} | ||
|
||
pub fn new(fragment_generators: impl IntoIterator<Item = Box<dyn FragmentGenerator>>) -> Self { | ||
Self { | ||
fragment_generators: fragment_generators.into_iter().collect(), | ||
} | ||
} | ||
|
||
pub fn default_with_custom_generators( | ||
custom_generators: impl IntoIterator<Item = Box<dyn FragmentGenerator>>, | ||
) -> Self { | ||
Self::new( | ||
Self::common_fragment_generators() | ||
.into_iter() | ||
.chain(custom_generators.into_iter()), | ||
) | ||
} | ||
} | ||
|
||
impl Default for GeneratorConfig { | ||
fn default() -> Self { | ||
Self::new(Self::common_fragment_generators()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.