pub struct ScaffoldedFile {
pub path: PathBuf,
pub content: String,
}Expand description
A file that will be created as part of project scaffolding.
§Fields
path: Relative or absolute path where the file should be writtencontent: The complete text content of the file
Fields§
§path: PathBufPath where the file should be written
content: StringComplete content of the file
Implementations§
Source§impl ScaffoldedFile
impl ScaffoldedFile
Sourcepub const fn new(path: PathBuf, content: String) -> Self
pub const fn new(path: PathBuf, content: String) -> Self
Create a new scaffolded file.
§Arguments
path: The target path for this filecontent: The file content as a string
§Example
use spikard_cli::init::ScaffoldedFile;
use std::path::PathBuf;
let file = ScaffoldedFile::new(
PathBuf::from("src/main.py"),
"print('Hello, world!')".to_string(),
);
assert_eq!(file.path, PathBuf::from("src/main.py"));
assert!(file.content.contains("Hello"));Trait Implementations§
Source§impl Clone for ScaffoldedFile
impl Clone for ScaffoldedFile
Source§fn clone(&self) -> ScaffoldedFile
fn clone(&self) -> ScaffoldedFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ScaffoldedFile
impl RefUnwindSafe for ScaffoldedFile
impl Send for ScaffoldedFile
impl Sync for ScaffoldedFile
impl Unpin for ScaffoldedFile
impl UnsafeUnpin for ScaffoldedFile
impl UnwindSafe for ScaffoldedFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more