pub struct MemoryConfigEnvironment { /* private fields */ }Expand description
In-memory implementation of ConfigEnvironment for testing.
§Example
ⓘ
use crate::config::MemoryConfigEnvironment;
let env = MemoryConfigEnvironment::new()
.with_unified_config_path("/test/config/ralph-workflow.toml")
.with_prompt_path("/test/repo/PROMPT.md")
.with_file("/test/repo/existing.txt", "content")
.with_env_var("RALPH_DEVELOPER_ITERS", "10");
// Write a file
env.write_file(Path::new("/test/new.txt"), "new content")?;
// Verify it was written
assert!(env.was_written(Path::new("/test/new.txt")));
assert_eq!(env.get_file(Path::new("/test/new.txt")), Some("new content".to_string()));Implementations§
Source§impl MemoryConfigEnvironment
impl MemoryConfigEnvironment
pub fn new() -> Self
pub fn with_unified_config_path<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_local_config_path<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_prompt_path<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_file<P: Into<PathBuf>, S: Into<String>>( self, path: P, content: S, ) -> Self
pub fn with_worktree_root<P: Into<PathBuf>>(self, path: P) -> Self
pub fn with_env_var( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn get_file(&self, path: &Path) -> Option<String>
pub fn was_written(&self, path: &Path) -> bool
Trait Implementations§
Source§impl Clone for MemoryConfigEnvironment
impl Clone for MemoryConfigEnvironment
Source§fn clone(&self) -> MemoryConfigEnvironment
fn clone(&self) -> MemoryConfigEnvironment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConfigEnvironment for MemoryConfigEnvironment
impl ConfigEnvironment for MemoryConfigEnvironment
Source§fn unified_config_path(&self) -> Option<PathBuf>
fn unified_config_path(&self) -> Option<PathBuf>
Get the path to the unified config file. Read more
Source§fn get_env_var(&self, key: &str) -> Option<String>
fn get_env_var(&self, key: &str) -> Option<String>
Get a single environment variable by name. Read more
Source§fn local_config_path(&self) -> Option<PathBuf>
fn local_config_path(&self) -> Option<PathBuf>
Get the path to the local config file. Read more
Source§fn prompt_path(&self) -> PathBuf
fn prompt_path(&self) -> PathBuf
Get the path to the PROMPT.md file. Read more
Source§fn file_exists(&self, path: &Path) -> bool
fn file_exists(&self, path: &Path) -> bool
Check if a file exists at the given path.
Source§impl Debug for MemoryConfigEnvironment
impl Debug for MemoryConfigEnvironment
Source§impl Default for MemoryConfigEnvironment
impl Default for MemoryConfigEnvironment
Source§fn default() -> MemoryConfigEnvironment
fn default() -> MemoryConfigEnvironment
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryConfigEnvironment
impl RefUnwindSafe for MemoryConfigEnvironment
impl Send for MemoryConfigEnvironment
impl Sync for MemoryConfigEnvironment
impl Unpin for MemoryConfigEnvironment
impl UnsafeUnpin for MemoryConfigEnvironment
impl UnwindSafe for MemoryConfigEnvironment
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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