pub struct EnvironmentContext {
pub working_directory: PathBuf,
pub platform: String,
pub os_version: Option<String>,
pub date: String,
}Expand description
Environment context information.
Contains details about the current working environment that can be included in the system prompt to give the LLM context awareness.
Fields§
§working_directory: PathBufCurrent working directory.
platform: StringOperating system (e.g., “darwin”, “linux”, “windows”).
os_version: Option<String>OS version string (e.g., “Darwin 25.2.0”).
date: StringToday’s date in YYYY-MM-DD format.
Implementations§
Source§impl EnvironmentContext
impl EnvironmentContext
Sourcepub fn gather() -> EnvironmentContext
pub fn gather() -> EnvironmentContext
Gather environment context from the current system.
This collects:
- Current working directory
- Platform (OS type)
- OS version (via uname on Unix, ver on Windows)
- Current date
Sourcepub fn to_prompt_section(&self) -> String
pub fn to_prompt_section(&self) -> String
Format the environment context as a system prompt section.
Returns a string wrapped in <env> tags suitable for appending
to a system prompt.
Trait Implementations§
Source§impl Clone for EnvironmentContext
impl Clone for EnvironmentContext
Source§fn clone(&self) -> EnvironmentContext
fn clone(&self) -> EnvironmentContext
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 Debug for EnvironmentContext
impl Debug for EnvironmentContext
Source§impl Default for EnvironmentContext
impl Default for EnvironmentContext
Source§fn default() -> EnvironmentContext
fn default() -> EnvironmentContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EnvironmentContext
impl RefUnwindSafe for EnvironmentContext
impl Send for EnvironmentContext
impl Sync for EnvironmentContext
impl Unpin for EnvironmentContext
impl UnwindSafe for EnvironmentContext
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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