Struct cli_sandbox::Project

source ·
pub struct Project { /* private fields */ }

Implementations§

source§

impl Project

source

pub fn new() -> Result<Self>

Creates a new Project

source

pub fn path(&self) -> &Path

Gets the std::path::Path for the Project’s temporary directory.

source

pub fn new_file<P: AsRef<Path>>( &mut self, path: P, contents: &str ) -> Result<()>

Creates a new file with a relative path to the project’s directory.

path gets redirected to the project’s real path (temporary and unknown).

source

pub fn check_file<P: AsRef<Path>>(&self, path: P, contents: &str) -> Result<()>

Checks that the contents of a file are correct. It will panic if they aren’t, and show the differences if the feature pretty_assertions is enabled

path gets redirected to the project’s real path (temporary and unknown)

Panics

Will panic if the contents of the file at path aren’t encoded as UTF-8

source

pub fn command<I, S>(&self, args: I) -> Result<Output>where I: IntoIterator<Item = S>, S: AsRef<OsStr>,

Executes a command relative to the project’s directory

Trait Implementations§

source§

impl Debug for Project

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.