DevService

Struct DevService 

Source
pub struct DevService { /* private fields */ }
Expand description

Development mode service

Provides business logic for development mode operations:

  • Port availability checking
  • Redis state management
  • Simulation path resolution
  • Environment variable setup

§Examples

use mecha10_cli::services::DevService;

let service = DevService::new();

// Check if port is available
if service.is_port_available(11008)? {
    println!("Port 11008 is available");
}

// Flush Redis for clean dev session
service.flush_redis(&mut redis_conn).await?;

Implementations§

Source§

impl DevService

Source

pub fn new(redis_url: String) -> Self

Create a new dev service

§Arguments
  • redis_url - Redis connection URL
Source

pub async fn load_project_info( ctx: &mut CliContext, ) -> Result<(String, String, ProjectConfig)>

Load project information from context

§Returns

Tuple of (project_name, project_version, project_config)

Source

pub fn resolve_simulation_paths( ctx: &mut CliContext, config: &ProjectConfig, ) -> Result<Option<SimulationPaths>>

Resolve simulation paths from configuration

Loads simulation config from configs/{profile}/simulation/{scenario}.json based on mecha10.json simulation settings.

§Arguments
  • ctx - CLI context
  • config - Project configuration
§Returns

Optional SimulationPaths struct with model and environment paths

Source

pub fn is_port_available(&self, port: u16) -> Result<bool>

Check if a port is available

§Arguments
  • port - Port number to check
§Returns

Ok(true) if port is available, Ok(false) if in use

Source

pub fn is_port_in_use(&self, port: u16) -> Result<bool>

Check if a port is in use

§Arguments
  • port - Port number to check
§Returns

Ok(true) if port is in use, Ok(false) if available

Source

pub async fn flush_redis<C>(&self, conn: &mut C) -> Result<()>
where C: ConnectionLike,

Flush Redis database for clean dev session

§Arguments
  • conn - Mutable reference to Redis connection (generic type)
§Errors

Returns error if Redis FLUSHALL command fails

Source

pub fn get_default_env_vars(&self) -> HashMap<String, String>

Get default environment variables for dev mode

§Returns

HashMap of environment variable key-value pairs

Note: This method is no longer used by CLI (replaced by node-runner in Phase 2). Kept for testing purposes.

Source

pub fn build_godot_args( &self, godot_project_path: &Path, model_path: &Path, env_path: &Path, model_config_path: Option<&PathBuf>, env_config_path: Option<&PathBuf>, headless: bool, networking: Option<&NetworkingConfig>, ) -> Vec<String>

Build Godot launch command arguments

§Arguments
  • godot_project_path - Path to Godot project directory
  • model_path - Path to robot model directory
  • env_path - Path to environment directory
  • headless - Run Godot in headless mode (no GUI)
§Returns

Vector of command-line arguments for Godot

Source

pub fn get_godot_project_path(&self) -> PathBuf

Determine Godot project path based on environment

§Returns

PathBuf to Godot project directory

Trait Implementations§

Source§

impl Default for DevService

Source§

fn default() -> Self

Returns the “default value” for a type. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more