pub struct Plan {
pub command: String,
pub changes: Vec<FileChange>,
pub notes: Vec<String>,
}Expand description
What a generator would do: the files, and what to add by hand.
Fields§
§command: StringThe command line it answers (rws gen model Post title:String).
changes: Vec<FileChange>§notes: Vec<String>Steps the generator leaves to the person (a line it couldn’t add safely, a model to register with the dev MCP endpoint).
Implementations§
Source§impl Plan
impl Plan
Sourcepub fn has_conflicts(&self) -> bool
pub fn has_conflicts(&self) -> bool
Any file in the way (ChangeKind::Conflict).
Sourcepub fn is_unchanged(&self) -> bool
pub fn is_unchanged(&self) -> bool
Nothing to write: every file is already as generated.
Sourcepub fn apply(&self, dir: impl AsRef<Path>) -> Result<Vec<String>, GenError>
pub fn apply(&self, dir: impl AsRef<Path>) -> Result<Vec<String>, GenError>
Write the plan under dir: new files are created (never replacing
one that appeared since plan), edited files rewritten only if
they still hold what was read. Refused whole when there is a
conflict. Answers the paths written.
Sourcepub fn render(&self, diffs: bool) -> String
pub fn render(&self, diffs: bool) -> String
For people: one line per file (create src/models/post.rs), the
diffs of conflicts — and of every change with diffs — then the
notes.
Sourcepub fn to_json(&self, written: bool) -> String
pub fn to_json(&self, written: bool) -> String
For agents: {"command":…,"status":…,"written":…,"changes":[{"path","action","diff"}],"notes":[…]}.
written: whether Plan::apply ran.
Trait Implementations§
impl Eq for Plan
impl StructuralPartialEq for Plan
Auto Trait Implementations§
impl Freeze for Plan
impl RefUnwindSafe for Plan
impl Send for Plan
impl Sync for Plan
impl Unpin for Plan
impl UnsafeUnpin for Plan
impl UnwindSafe for Plan
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
map-response-body only.Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
trace only.