pub struct ForgeState { /* private fields */ }Implementations§
Source§impl ForgeState
impl ForgeState
Sourcepub fn from_config(config: &ForgeUserConfig) -> Option<Self>
pub fn from_config(config: &ForgeUserConfig) -> Option<Self>
Initialise Forge from user configuration. Returns None when no API
key is configured for the active provider, or the runtime cannot start.
Sourcepub fn with_api_key(api_key: impl Into<String>) -> Option<Self>
pub fn with_api_key(api_key: impl Into<String>) -> Option<Self>
Initialise Forge with explicit credentials (used when saving keys in UI).
Sourcepub fn apply_config(&mut self, config: &ForgeUserConfig) -> bool
pub fn apply_config(&mut self, config: &ForgeUserConfig) -> bool
Apply UI configuration (provider, model, active API key).
pub fn provider(&self) -> ForgeProvider
pub fn model(&self) -> &str
pub fn set_provider(&mut self, provider: ForgeProvider)
pub fn set_model(&mut self, model: impl Into<String>)
Sourcepub fn set_api_key(&mut self, api_key: impl Into<String>) -> bool
pub fn set_api_key(&mut self, api_key: impl Into<String>) -> bool
Replace the API key for the active provider.
Sourcepub fn start(&mut self, prompt: String) -> Result<u64>
pub fn start(&mut self, prompt: String) -> Result<u64>
Create a new session and start a background Claude stream.
Returns the session id (always > 0).
Sourcepub fn revise(&mut self, id: u64, prompt: String) -> Result<()>
pub fn revise(&mut self, id: u64, prompt: String) -> Result<()>
Re-prompt an existing creation. The current src/lib.rs and latest
prompt are included so Claude edits the app rather than starting over.
Sourcepub fn snapshot(&self, id: u64) -> Option<ForgeSnapshot>
pub fn snapshot(&self, id: u64) -> Option<ForgeSnapshot>
Fetch a read-only snapshot of a session, if it exists.
Sourcepub fn list_creations(&self) -> Vec<ForgeCreationSummary>
pub fn list_creations(&self) -> Vec<ForgeCreationSummary>
List all known creations, newest-first.
Sourcepub fn delete_creation(&mut self, id: u64) -> Result<()>
pub fn delete_creation(&mut self, id: u64) -> Result<()>
Delete a creation and its generated project directory.
Sourcepub fn build(&mut self, id: u64) -> Result<()>
pub fn build(&mut self, id: u64) -> Result<()>
Kick off a cargo build for a session whose streaming is done.
Subsequent calls while building are no-ops. Does NOT consume an
auto-retry — this is an explicit manual rebuild (e.g. after the
user edits an error message and wants another shot).
Sourcepub fn set_auto_fix(&mut self, id: u64, enabled: bool)
pub fn set_auto_fix(&mut self, id: u64, enabled: bool)
Toggle auto-fix on a session. No-op if the session doesn’t exist.
Sourcepub fn artifact_bytes(&self, id: u64) -> Option<Vec<u8>>
pub fn artifact_bytes(&self, id: u64) -> Option<Vec<u8>>
Read the built artifact bytes for a session, if the build succeeded.
Sourcepub fn system_prompt_len(&self) -> usize
pub fn system_prompt_len(&self) -> usize
Convenience for the UI: the system prompt length (tokens ~ chars/4), so we can show a rough “context used” indicator.
pub fn output_dir(&self) -> PathBuf
pub fn set_output_dir(&mut self, dir: PathBuf) -> Result<()>
Auto Trait Implementations§
impl !Freeze for ForgeState
impl RefUnwindSafe for ForgeState
impl Send for ForgeState
impl Sync for ForgeState
impl Unpin for ForgeState
impl UnsafeUnpin for ForgeState
impl UnwindSafe for ForgeState
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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