pub struct InjectionContext {
pub project: Option<String>,
pub language: Option<String>,
pub framework: Option<String>,
pub architecture: 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
Re-export core types for convenience. 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”).
architecture: Option<String>Architectural context (e.g., “Clean Architecture”, “Microservices”, “Tailwind CSS”).
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 new() -> InjectionContext
pub fn new() -> InjectionContext
Create a new empty context.
Sourcepub fn with_project(self, project: impl Into<String>) -> InjectionContext
pub fn with_project(self, project: impl Into<String>) -> InjectionContext
Set the project name.
Sourcepub fn with_language(self, language: impl Into<String>) -> InjectionContext
pub fn with_language(self, language: impl Into<String>) -> InjectionContext
Set the target language.
Sourcepub fn with_framework(self, framework: impl Into<String>) -> InjectionContext
pub fn with_framework(self, framework: impl Into<String>) -> InjectionContext
Set the framework.
Sourcepub fn with_architecture(
self,
architecture: impl Into<String>,
) -> InjectionContext
pub fn with_architecture( self, architecture: impl Into<String>, ) -> InjectionContext
Set the architectural context.
Sourcepub fn with_style(self, style: StyleGuide) -> InjectionContext
pub fn with_style(self, style: StyleGuide) -> InjectionContext
Set the style guide.
Sourcepub fn with_surrounding_code(self, code: impl Into<String>) -> InjectionContext
pub fn with_surrounding_code(self, code: impl Into<String>) -> InjectionContext
Add surrounding code context.
Sourcepub fn add_import(self, import: impl Into<String>) -> InjectionContext
pub fn add_import(self, import: impl Into<String>) -> InjectionContext
Add an available import.
Sourcepub fn set_variable(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> InjectionContext
pub fn set_variable( self, key: impl Into<String>, value: impl Into<String>, ) -> InjectionContext
Set a variable.
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<InjectionContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<InjectionContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for InjectionContext
impl Hash for InjectionContext
Source§impl PartialEq for InjectionContext
impl PartialEq for InjectionContext
Source§impl Serialize for InjectionContext
impl Serialize for InjectionContext
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for InjectionContext
impl StructuralPartialEq for InjectionContext
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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().