pub struct InjectionContext {
pub project: Option<String>,
pub language: Option<String>,
pub framework: Option<String>,
pub style: Option<StyleGuide>,
pub surrounding_code: Option<String>,
pub available_imports: Vec<String>,
pub variables: HashMap<String, String>,
pub extra: HashMap<String, Value>,
}Expand description
Context for AI code injection.
This provides additional information to the AI model to help generate more relevant and accurate code.
Fields§
§project: Option<String>Project name or identifier.
language: Option<String>Target language (e.g., “rust”, “html”, “typescript”).
framework: Option<String>Framework being used (e.g., “react”, “vue”, “actix-web”).
style: Option<StyleGuide>Coding style preferences.
surrounding_code: Option<String>Surrounding code context.
available_imports: Vec<String>Import statements available.
variables: HashMap<String, String>Custom variables for template expansion.
extra: HashMap<String, Value>Additional metadata.
Implementations§
Source§impl InjectionContext
impl InjectionContext
Sourcepub fn with_project(self, project: impl Into<String>) -> Self
pub fn with_project(self, project: impl Into<String>) -> Self
Set the project name.
Sourcepub fn with_language(self, language: impl Into<String>) -> Self
pub fn with_language(self, language: impl Into<String>) -> Self
Set the target language.
Sourcepub fn with_framework(self, framework: impl Into<String>) -> Self
pub fn with_framework(self, framework: impl Into<String>) -> Self
Set the framework.
Sourcepub fn with_style(self, style: StyleGuide) -> Self
pub fn with_style(self, style: StyleGuide) -> Self
Set the style guide.
Sourcepub fn with_surrounding_code(self, code: impl Into<String>) -> Self
pub fn with_surrounding_code(self, code: impl Into<String>) -> Self
Add surrounding code context.
Sourcepub fn add_import(self, import: impl Into<String>) -> Self
pub fn add_import(self, import: impl Into<String>) -> Self
Add an available import.
Trait Implementations§
Source§impl Clone for InjectionContext
impl Clone for InjectionContext
Source§fn clone(&self) -> InjectionContext
fn clone(&self) -> InjectionContext
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 InjectionContext
impl Debug for InjectionContext
Source§impl Default for InjectionContext
impl Default for InjectionContext
Source§fn default() -> InjectionContext
fn default() -> InjectionContext
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for InjectionContext
impl<'de> Deserialize<'de> for InjectionContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for InjectionContext
impl RefUnwindSafe for InjectionContext
impl Send for InjectionContext
impl Sync for InjectionContext
impl Unpin for InjectionContext
impl UnwindSafe for InjectionContext
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().