diff --git a/src/cargo/util/toml/embedded.rs b/src/cargo/util/toml/embedded.rs index fa603a1eed19..126188588b2d 100644 --- a/src/cargo/util/toml/embedded.rs +++ b/src/cargo/util/toml/embedded.rs @@ -189,7 +189,7 @@ fn sanitize_name(name: &str) -> String { } #[derive(Debug)] -struct ScriptSource<'s> { +pub struct ScriptSource<'s> { shebang: Option<&'s str>, info: Option<&'s str>, frontmatter: Option<&'s str>, @@ -197,7 +197,7 @@ struct ScriptSource<'s> { } impl<'s> ScriptSource<'s> { - fn parse(input: &'s str) -> CargoResult { + pub fn parse(input: &'s str) -> CargoResult { let mut source = Self { shebang: None, info: None, @@ -280,19 +280,19 @@ impl<'s> ScriptSource<'s> { Ok(source) } - fn shebang(&self) -> Option<&'s str> { + pub fn shebang(&self) -> Option<&'s str> { self.shebang } - fn info(&self) -> Option<&'s str> { + pub fn info(&self) -> Option<&'s str> { self.info } - fn frontmatter(&self) -> Option<&'s str> { + pub fn frontmatter(&self) -> Option<&'s str> { self.frontmatter } - fn content(&self) -> &'s str { + pub fn content(&self) -> &'s str { self.content } } diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index bd1fcf142c9e..d59ba0ef4ea8 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -39,6 +39,8 @@ mod targets; use self::targets::to_targets; +pub use embedded::ScriptSource; + /// See also `bin/cargo/commands/run.rs`s `is_manifest_command` pub fn is_embedded(path: &Path) -> bool { let ext = path.extension();