pub struct BranchSpec {
pub type_: String,
pub issue: String,
pub desc: String,
}Fields§
§type_: String§issue: String§desc: StringImplementations§
Source§impl BranchSpec
impl BranchSpec
Sourcepub fn new(
type_: impl Into<String>,
issue: impl Into<String>,
desc: impl Into<String>,
) -> Result<Self>
pub fn new( type_: impl Into<String>, issue: impl Into<String>, desc: impl Into<String>, ) -> Result<Self>
Construct a BranchSpec validated against the built-in branch
types. Kept for callers (tests, internal helpers) that don’t have
a crate::config::Config in scope; production code paths
(gwm create, TUI create) should use Self::new_with_types
with the resolved list so per-repo overrides are honoured.
Sourcepub fn new_with_types(
type_: impl Into<String>,
issue: impl Into<String>,
desc: impl Into<String>,
allowed: &[BranchType],
) -> Result<Self>
pub fn new_with_types( type_: impl Into<String>, issue: impl Into<String>, desc: impl Into<String>, allowed: &[BranchType], ) -> Result<Self>
Construct a BranchSpec validated against the supplied list of
allowed branch types — typically the output of
crate::config::Config::resolved_branch_types.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate against the built-in branch types. Convenience wrapper
around Self::validate_against for legacy call sites.
Sourcepub fn validate_against(&self, allowed: &[BranchType]) -> Result<()>
pub fn validate_against(&self, allowed: &[BranchType]) -> Result<()>
Validate against the supplied list of allowed branch types. The
error message produced when the type is rejected enumerates the
allowed names so the TUI status bar / CLI stderr always shows the
repo-local truth (built-in or .gwm.toml-driven).
pub fn branch_name(&self, cfg: &WorktreeConfig, repo: &str) -> Result<String>
pub fn worktree_dirname( &self, cfg: &WorktreeConfig, repo: &str, ) -> Result<String>
Sourcepub fn worktree_path(
&self,
cfg: &WorktreeConfig,
repo: &str,
repo_path: &Path,
) -> Result<PathBuf>
pub fn worktree_path( &self, cfg: &WorktreeConfig, repo: &str, repo_path: &Path, ) -> Result<PathBuf>
Resolve the absolute worktree path for this spec. repo_path is the
main repo’s working directory on disk — it feeds the {repo_path} /
{repo_parent} placeholders so a base like {repo_parent}/worktrees
can be expressed relative to the repo (matching, e.g., an editor’s
../worktrees convention).
Trait Implementations§
Source§impl Clone for BranchSpec
impl Clone for BranchSpec
Source§fn clone(&self) -> BranchSpec
fn clone(&self) -> BranchSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for BranchSpec
impl RefUnwindSafe for BranchSpec
impl Send for BranchSpec
impl Sync for BranchSpec
impl Unpin for BranchSpec
impl UnsafeUnpin for BranchSpec
impl UnwindSafe for BranchSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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