pub struct Branch<M = Unselected> { /* private fields */ }Expand description
Type-safe builder for p4 branch.
Create or edit a branch mapping and its view.
§Syntax
p4 [g-opts] branch [-f] branchspec
p4 [g-opts] branch -d [-f] branchspec
p4 [g-opts] branch -i [-f]
p4 [g-opts] branch [-S stream] -o placeholderForStreamBranchSpecName
p4 [g-opts] branch [-S stream -P parent] -o placeholderForStreamBranchSpecNameThe M type parameter tracks the command form at compile time, starting
as Unselected from Branch::new. Enter a form with one of
Self::force, Self::delete, Self::stdin, or Self::stdout:
GeneralMode(entered viaSelf::force): create or edit a branch mapping; can transition toDeleteModeorStdinModepreserving the-fflag.DeleteMode(-d, entered viaSelf::delete): delete a branch mapping.StdinMode(-i, entered viaSelf::stdin): read the branch mapping from standard input.StdoutMode(-o, entered viaSelf::stdout): write the branch mapping to standard output;Branch::streamsupplies-Sand transitions to theStreamSelectedstate, which unlocksBranch::parent(-Prequires-S).
Implementations§
Source§impl Branch<Unselected>
impl Branch<Unselected>
Sourcepub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self
pub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self
Creates a new p4 branch command with no form selected.
bin is the path to the Perforce command-line executable. Use
Self::force, Self::delete, Self::stdin, or
Self::stdout to select a form before spawning.
Sourcepub fn force(self, v: bool) -> Branch<GeneralMode>
pub fn force(self, v: bool) -> Branch<GeneralMode>
Enters the general form: p4 branch [-f] branchspec.
v sets the initial state of the -f flag.
Sourcepub fn delete(self) -> Branch<DeleteMode>
pub fn delete(self) -> Branch<DeleteMode>
Enters the delete form: p4 branch -d [-f] branchspec.
Sourcepub fn stdout(self) -> Branch<StdoutMode>
pub fn stdout(self) -> Branch<StdoutMode>
Enters the stdout form: p4 branch [-S stream [-P parent]] -o placeholder.
Use Branch::stream on the entered form to supply -S; that
transitions to the StreamSelected state and unlocks
Branch::parent (-P requires -S).
Source§impl<M> Branch<M>
impl<M> Branch<M>
Sourcepub fn get_global_opts(&self) -> &GlobalOpts
pub fn get_global_opts(&self) -> &GlobalOpts
Sourcepub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self
pub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self
Sourcepub fn global_opts(self, v: GlobalOpts) -> Self
pub fn global_opts(self, v: GlobalOpts) -> Self
Source§impl Branch<GeneralMode>
impl Branch<GeneralMode>
Sourcepub fn get_force(&self) -> bool
pub fn get_force(&self) -> bool
§Description
-f
Force option. Combined with -d, permits P4 Server administrators to
delete branches they don’t own. Also permits administrators to change
the modification date of the branch mapping (the Update field is
writable when using the -f option).
Sourcepub fn set_force(&mut self, v: bool) -> &mut Self
pub fn set_force(&mut self, v: bool) -> &mut Self
§Description
-f
Force option. Combined with -d, permits P4 Server administrators to
delete branches they don’t own. Also permits administrators to change
the modification date of the branch mapping (the Update field is
writable when using the -f option).
Sourcepub fn force(self, v: bool) -> Self
pub fn force(self, v: bool) -> Self
§Description
-f
Force option. Combined with -d, permits P4 Server administrators to
delete branches they don’t own. Also permits administrators to change
the modification date of the branch mapping (the Update field is
writable when using the -f option).
Sourcepub fn delete(self) -> Branch<DeleteMode>
pub fn delete(self) -> Branch<DeleteMode>
Transitions to the delete form (-d), preserving the -f flag.
Source§impl Branch<DeleteMode>
impl Branch<DeleteMode>
Source§impl Branch<StdinMode>
impl Branch<StdinMode>
Sourcepub fn get_force(&self) -> bool
pub fn get_force(&self) -> bool
§Description
-f
Force option. Permits administrators to change the modification date of the branch mapping.
Source§impl Branch<StdoutMode<Unselected>>
impl Branch<StdoutMode<Unselected>>
Sourcepub fn stream(self, v: impl Into<String>) -> Branch<StdoutMode<StreamSelected>>
pub fn stream(self, v: impl Into<String>) -> Branch<StdoutMode<StreamSelected>>
§Description
-S stream
Display the mapping generated for the specified stream. This option enables you to see how change is propagated between the stream and its parent.
Transitions this command to the StreamSelected state, which
unlocks the -P option.
Source§impl Branch<StdoutMode<StreamSelected>>
impl Branch<StdoutMode<StreamSelected>>
Sourcepub fn get_stream(&self) -> &str
pub fn get_stream(&self) -> &str
Sourcepub fn set_stream(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_stream(&mut self, v: impl Into<String>) -> &mut Self
Sourcepub fn stream(self, v: impl Into<String>) -> Self
pub fn stream(self, v: impl Into<String>) -> Self
§Description
-S stream
The stream whose generated mapping is displayed. Preserves any -P
parent already set.
Sourcepub fn get_parent(&self) -> Option<&String>
pub fn get_parent(&self) -> Option<&String>
§Description
-P parent
For a specified stream, display the mapping that is generated by hypothetically treating the stream as if it were a child of the specified parent.
Sourcepub fn set_parent(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_parent(&mut self, v: impl Into<String>) -> &mut Self
§Description
-P parent
For a specified stream, display the mapping that is generated by hypothetically treating the stream as if it were a child of the specified parent.
Trait Implementations§
Source§impl ParameterizedSpawn<()> for Branch<GeneralMode>
impl ParameterizedSpawn<()> for Branch<GeneralMode>
Source§impl ParameterizedSpawn<()> for Branch<StdinMode>
impl ParameterizedSpawn<()> for Branch<StdinMode>
Source§fn spawn_with(&mut self, (): ()) -> Result<Self::Output, Self::Error>
fn spawn_with(&mut self, (): ()) -> Result<Self::Output, Self::Error>
Spawns p4 branch -i with a piped standard input stream (and piped
standard output and error streams); write the branch mapping
specification to the returned Child’s stdin handle.
type Output = Child
type Error = Error
Source§impl<I: AsRef<OsStr>> ParameterizedSpawn<(I,)> for Branch<GeneralMode>
impl<I: AsRef<OsStr>> ParameterizedSpawn<(I,)> for Branch<GeneralMode>
Source§fn spawn_with(
&mut self,
(branchspec): (I,),
) -> Result<Self::Output, Self::Error>
fn spawn_with( &mut self, (branchspec): (I,), ) -> Result<Self::Output, Self::Error>
Spawns p4 branch with the given branchspec argument as a child
process with piped standard output and error streams; use the
returned Child handle to wait for it or interact with it.
type Output = Child
type Error = Error
Source§impl<I: AsRef<OsStr>> ParameterizedSpawn<(I,)> for Branch<DeleteMode>
impl<I: AsRef<OsStr>> ParameterizedSpawn<(I,)> for Branch<DeleteMode>
Source§fn spawn_with(
&mut self,
(branchspec): (I,),
) -> Result<Self::Output, Self::Error>
fn spawn_with( &mut self, (branchspec): (I,), ) -> Result<Self::Output, Self::Error>
Spawns p4 branch -d with the given branchspec argument as a child
process with piped standard output and error streams; use the
returned Child handle to wait for it or interact with it.
type Output = Child
type Error = Error
Source§impl<S, I> ParameterizedSpawn<(I,)> for Branch<StdoutMode<S>>
impl<S, I> ParameterizedSpawn<(I,)> for Branch<StdoutMode<S>>
Source§fn spawn_with(
&mut self,
(placeholder): (I,),
) -> Result<Self::Output, Self::Error>
fn spawn_with( &mut self, (placeholder): (I,), ) -> Result<Self::Output, Self::Error>
Spawns p4 branch [-S stream [-P parent]] -o with the given placeholder
argument as a child process with piped standard output and error
streams; use the returned Child handle to wait for it or interact
with it.
type Output = Child
type Error = Error
Source§impl ParameterizedSpawn<(Stdio,)> for Branch<StdinMode>
impl ParameterizedSpawn<(Stdio,)> for Branch<StdinMode>
Source§fn spawn_with(&mut self, (stdio): (Stdio,)) -> Result<Self::Output, Self::Error>
fn spawn_with(&mut self, (stdio): (Stdio,)) -> Result<Self::Output, Self::Error>
Spawns p4 branch -i with the given standard input configuration and
piped standard output and error streams; use the returned Child
handle to wait for it or interact with it.
Pass Stdio::piped() to obtain a writable child.stdin handle and
feed the branch mapping specification into it; pass Stdio::inherit()
to read the specification from the spawning process’s own standard
input.