Struct Project

Source
pub struct Project {
    pub kind: ProjectType,
    pub root_path: PathBuf,
    pub build_arts: BuildArtifacts,
    pub name: Option<String>,
}
Expand description

Representation of a development project with cleanable build artifacts.

This struct encapsulates all information about a development project, including its type, location, build artifacts, and metadata extracted from project configuration files.

Fields§

§kind: ProjectType

Type of the project (Rust or Node.js)

§root_path: PathBuf

The root directory of the project where the configuration file is located

For Rust projects, this is the directory containing Cargo.toml. For Node.js projects, this is the directory containing package.json.

§build_arts: BuildArtifacts

The build directory to be cleaned and its metadata

Contains information about the target/ or node_modules/ directory that is a candidate for cleanup, including its path and total size.

§name: Option<String>

Name of the project extracted from configuration files

For Rust projects, this is extracted from the name field in Cargo.toml. For Node.js projects, this is extracted from the name field in package.json. May be None if the name cannot be determined or parsed.

Implementations§

Source§

impl Project

Source

pub fn new( kind: ProjectType, root_path: PathBuf, build_arts: BuildArtifacts, name: Option<String>, ) -> Self

Create a new project instance.

This constructor creates a new Project with the specified parameters. It’s typically used by the scanner when a valid development project is detected in the file system.

§Arguments
  • kind - The type of project (Rust or Node.js)
  • root_path - Path to the project’s root directory
  • build_arts - Information about the build artifacts to be cleaned
  • name - Optional project name extracted from configuration files
§Returns

A new Project instance with the specified parameters.

§Examples
let build_arts = BuildArtifacts {
    path: PathBuf::from("/path/to/project/target"),
    size: 1024,
};

let project = Project::new(
    ProjectType::Rust,
    PathBuf::from("/path/to/project"),
    build_arts,
    Some("my-project".to_string()),
);

Trait Implementations§

Source§

impl Clone for Project

Source§

fn clone(&self) -> Project

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Display for Project

Source§

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

Format the project for display with the appropriate emoji and name.

This implementation provides a human-readable representation of the project that includes:

  • An emoji indicator based on the project type (🦀 for Rust, 📦 for Node.js, 🐍 for Python, 🐹 for Go)
  • The project name if available, otherwise just the path
  • The project’s root path
§Examples
  • 🦀 my-rust-project (/path/to/project)
  • 📦 my-node-app (/path/to/app)
  • 🐍 my-python-project (/path/to/project)
  • 🐹 my-go-project (/path/to/project)
  • 🦀 /path/to/unnamed/project (when no name is available)

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.