diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-05-28 20:45:44 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2021-05-28 21:06:45 +0100 |
commit | 6757b2bd235da2163e40c38efceab5eaf1e345e8 (patch) | |
tree | affc72555821de87beee5629b1b5b26b0380db3f /subplotlib | |
parent | d6c0684fb5e0f902a9009fe02416b32fbe52ef57 (diff) | |
download | subplot-6757b2bd235da2163e40c38efceab5eaf1e345e8.tar.gz |
subplotlib: Add some basic docs to a bit of the files steplibrary
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'subplotlib')
-rw-r--r-- | subplotlib/src/steplibrary/files.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/subplotlib/src/steplibrary/files.rs b/subplotlib/src/steplibrary/files.rs index 169111d..35f841a 100644 --- a/subplotlib/src/steplibrary/files.rs +++ b/subplotlib/src/steplibrary/files.rs @@ -19,6 +19,13 @@ pub use crate::prelude::*; pub use super::datadir::Datadir; #[derive(Default)] +/// Context data for the `files` step library +/// +/// This context contains a mapping from filename to metadata so that +/// the various steps remember metadata and then query it later can find it. +/// +/// This context depends on, and will automatically register, the context for +/// the [`datadir`][crate::steplibrary::datadir] step library. pub struct Files { metadata: HashMap<String, Metadata>, } @@ -29,6 +36,13 @@ impl ContextElement for Files { } } +/// Create a file on disk from an embedded file +/// +/// # `given file {embedded_file}` +/// +/// Create a file in the data dir from an embedded file. +/// +/// This defers to [`create_from_embedded_with_other_name`] #[step] #[context(Datadir)] pub fn create_from_embedded(context: &ScenarioContext, embedded_file: SubplotDataFile) { @@ -36,6 +50,12 @@ pub fn create_from_embedded(context: &ScenarioContext, embedded_file: SubplotDat create_from_embedded_with_other_name::call(context, &filename_on_disk, embedded_file) } +/// Create a file on disk from an embedded file with a given name +/// +/// # `given file {filename_on_disk} from {embedded_file}` +/// +/// Creates a file in the data dir from an embedded file, but giving it a +/// potentially different name. #[step] pub fn create_from_embedded_with_other_name( context: &Datadir, |