pub(crate) struct CwdState {
pub(crate) path: Option<PathBuf>,
pub(crate) start_dir: Option<PathBuf>,
}Expand description
Resolves the cwd-persistence file location and any previously-restored
starting directory once per exec invocation.
Fields§
§path: Option<PathBuf>Where the ending $PWD gets written after this command runs, for the
next exec invocation to pick up. None if we couldn’t resolve a
location or create its parent dir — persistence is then simply
skipped for this call (never a hard failure; falls back to today’s
pre-fix behavior).
start_dir: Option<PathBuf>The directory to actually start this command’s shell in: the previously-persisted directory if one was found and still exists, otherwise this process’s own (fixed, inherited) cwd — the same default used before this fix existed.
Implementations§
Source§impl CwdState
impl CwdState
Sourcepub(crate) fn for_call(agent: Option<&str>, agent_unknown: bool) -> Self
pub(crate) fn for_call(agent: Option<&str>, agent_unknown: bool) -> Self
CwdState::load, or, when the call’s agent can’t be told
(Args::agent_unknown), the directory the shell was started in and
nothing written: any agent’s would be a guess.
Sourcepub(crate) fn load(agent: Option<&str>) -> Self
pub(crate) fn load(agent: Option<&str>) -> Self
agent: the subagent that made the call, if any. A subagent keeps
its own state file next to the instance’s: it starts where it last
left off, or, on its first call, where the main agent is; and its
cd is written only to its own file. Before this, the main agent and
every subagent shared the instance’s file, so a subagent’s cd moved
the main agent’s next command into the subagent’s checkout, where a
git commit committed the subagent’s work
(docs/specs/SPEC_BASHWRAP_PER_AGENT_CWD_2026_10_18.md).
Auto Trait Implementations§
impl Freeze for CwdState
impl RefUnwindSafe for CwdState
impl Send for CwdState
impl Sync for CwdState
impl Unpin for CwdState
impl UnsafeUnpin for CwdState
impl UnwindSafe for CwdState
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<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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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