Skip to main content

ProjectGenerator

Struct ProjectGenerator 

Source
pub struct ProjectGenerator { /* private fields */ }

Implementations§

Source§

impl ProjectGenerator

Source

pub fn discover(start: impl AsRef<Path>) -> Result<Self, ScaffoldError>

Locate the Phoenix project containing start.

§Errors

Returns an error when no parent contains the expected Phoenix layout.

Source

pub fn root(&self) -> &Path

Source

pub fn refresh_types(&self) -> Result<bool, ScaffoldError>

Refresh generated TypeScript contracts after a Rust generator runs.

Returns Ok(false) before JavaScript dependencies are installed; Vite will still generate the files when development starts.

§Errors

Returns an error when the installed Phoenix Vite generator fails.

Source

pub fn controller( &self, name: &str, options: ControllerOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate a controller and optionally its conventional resource route.

§Errors

Returns an error for invalid names, conflicts, or malformed managed files.

Source

pub fn model( &self, name: &str, options: ModelOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate a Toasty model and any requested companion artifacts.

--all creates the currently supported cohesive business slice: model, migration, request, API resource, resource controller/route, and index page.

§Errors

Returns an error for invalid names, conflicts, or malformed managed files.

Source

pub fn migration( &self, name: &str, options: GenerateOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate one migration and register it in database/migrations/mod.rs.

§Errors

Returns an error for invalid names, conflicts, time, or managed files.

Source

pub fn request( &self, name: &str, options: GenerateOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate a validated request DTO and update its Rust module.

§Errors

Returns an error for invalid names, conflicts, or malformed managed files.

Source

pub fn resource( &self, name: &str, options: GenerateOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate a browser-safe API resource and update its Rust module.

§Errors

Returns an error for invalid names, conflicts, or malformed managed files.

Source

pub fn middleware( &self, name: &str, options: GenerateOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate a pass-through middleware ready for application logic.

§Errors

Returns an error for invalid names, conflicts, or malformed managed files.

Source

pub fn page( &self, name: &str, options: GenerateOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate a React page plus its Rust Page Props contract.

§Errors

Returns an error for invalid names, conflicts, or malformed managed files.

Source

pub fn island( &self, name: &str, options: GenerateOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate a React Island component.

§Errors

Returns an error for invalid names, conflicts, or file-system failures.

Source

pub fn command( &self, name: &str, options: GenerateOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate a console command and register it in app/commands/mod.rs.

§Errors

Returns an error for invalid names, conflicts, or malformed managed files.

Source

pub fn add_feature( &self, feature: ProjectFeature, ) -> Result<FeatureAddResult, ScaffoldError>

Enable one official Feature in an existing Phoenix project.

The command writes only the requested Feature’s TOML starter, preserves existing environment examples, and refreshes the generated FeatureSet assembly only when the project already opted into that scaffold pattern.

§Errors

Returns an error when project metadata or Cargo.toml cannot be read or written.

Source

pub fn auth( &self, options: GenerateOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Generate the authentication starter kit (px make:auth).

Creates named login / logout / register / password-reset routes with a stricter rate limit, an AuthController, validated request contracts, browser-safe resources, page props, and React form pages.

§Errors

Returns an error for conflicts or malformed managed files.

Source

pub fn update_core( &self, options: &UpdateProjectOptions, ) -> Result<Vec<PathBuf>, ScaffoldError>

Refresh framework-owned core files without touching business code.

Updates src/lib.rs / src/main.rs, Vite/TS config, config schemas, dependency pins for phoenixrs / @apizero/*, and (when the project uses a database) src/bin/phoenix-manage.rs. Leaves controllers, routes, pages, and user TOML alone.

§Errors

Returns an error for invalid local framework roots, I/O failures, or npm failures.

Trait Implementations§

Source§

impl Clone for ProjectGenerator

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ProjectGenerator

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 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> Same for T

Source§

type Output = T

Should always be Self
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.