Skip to main content

Branch

Struct Branch 

Source
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 placeholderForStreamBranchSpecName

The 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:

Implementations§

Source§

impl Branch<Unselected>

Source

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.

Source

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.

Source

pub fn delete(self) -> Branch<DeleteMode>

Enters the delete form: p4 branch -d [-f] branchspec.

Source

pub fn stdin(self) -> Branch<StdinMode>

Enters the stdin form: p4 branch -i [-f].

Source

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>

Source

pub fn get_bin(&self) -> &Path

Get the Perforce command path.

Source

pub fn set_bin(&mut self, bin: impl Into<PathBuf>) -> &mut Self

Set the Perforce command path.

Source

pub fn bin(self, bin: impl Into<PathBuf>) -> Self

Set the Perforce command path.

Source

pub fn get_global_opts(&self) -> &GlobalOpts

§Description

g-opts

See Global options.

Source

pub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self

§Description

g-opts

See Global options.

Source

pub fn global_opts(self, v: GlobalOpts) -> Self

§Description

g-opts

See Global options.

Source§

impl Branch<GeneralMode>

Source

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).

Source

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).

Source

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).

Source

pub fn delete(self) -> Branch<DeleteMode>

Transitions to the delete form (-d), preserving the -f flag.

Source

pub fn stdin(self) -> Branch<StdinMode>

Transitions to the stdin form (-i), preserving the -f flag.

Source§

impl Branch<DeleteMode>

Source

pub fn get_force(&self) -> bool

§Description

-f

Force option. Permits P4 Server administrators to delete branches they don’t own.

Source

pub fn set_force(&mut self, v: bool) -> &mut Self

§Description

-f

Force option. Permits P4 Server administrators to delete branches they don’t own.

Source

pub fn force(self, v: bool) -> Self

§Description

-f

Force option. Permits P4 Server administrators to delete branches they don’t own.

Source§

impl Branch<StdinMode>

Source

pub fn get_force(&self) -> bool

§Description

-f

Force option. Permits administrators to change the modification date of the branch mapping.

Source

pub fn set_force(&mut self, v: bool) -> &mut Self

§Description

-f

Force option. Permits administrators to change the modification date of the branch mapping.

Source

pub fn force(self, v: bool) -> Self

§Description

-f

Force option. Permits administrators to change the modification date of the branch mapping.

Source§

impl Branch<StdoutMode<Unselected>>

Source

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>>

Source

pub fn get_stream(&self) -> &str

§Description

-S stream

The stream whose generated mapping is displayed.

Source

pub fn set_stream(&mut self, v: impl Into<String>) -> &mut Self

§Description

-S stream

The stream whose generated mapping is displayed.

Source

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.

Source

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.

Source

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.

Source

pub fn parent(self, v: impl Into<String>) -> 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<M: Clone> Clone for Branch<M>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: Debug> Debug for Branch<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M: Default> Default for Branch<M>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ParameterizedSpawn<()> for Branch<GeneralMode>

Source§

fn spawn_with(&mut self, (): ()) -> Result<Self::Output, Self::Error>

Spawns p4 branch (the general form) without a branchspec argument, opening the editor to create a new branch mapping.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl ParameterizedSpawn<()> for Branch<StdinMode>

Source§

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.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<I: AsRef<OsStr>> ParameterizedSpawn<(I,)> for Branch<GeneralMode>

Source§

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.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<I: AsRef<OsStr>> ParameterizedSpawn<(I,)> for Branch<DeleteMode>

Source§

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.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<S, I> ParameterizedSpawn<(I,)> for Branch<StdoutMode<S>>

Source§

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.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl ParameterizedSpawn<(Stdio,)> for Branch<StdinMode>

Source§

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.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<M: ExclusiveOption> SubCommand for Branch<M>

Source§

fn name(&self) -> &str

Source§

fn inject_local_args(&self, command: &mut Command)

Source§

fn global_opts(&self) -> Option<&GlobalOpts>

Source§

fn inject_args(&self, command: &mut Command)

Source§

fn setup_command<S: AsRef<OsStr>>(&self, bin: S) -> Command

Auto Trait Implementations§

§

impl<M> Freeze for Branch<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for Branch<M>
where M: RefUnwindSafe,

§

impl<M> Send for Branch<M>
where M: Send,

§

impl<M> Sync for Branch<M>
where M: Sync,

§

impl<M> Unpin for Branch<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for Branch<M>
where M: UnsafeUnpin,

§

impl<M> UnwindSafe for Branch<M>
where M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OutputExt for T
where T: SpawnExt<Output = Child, Error = Error>,

Source§

impl<T, T1> OutputExt1<T1> for T
where T: SpawnExt1<T1, Output = Child, Error = Error>,

Source§

fn output( &mut self, a: T1, ) -> Result<Output, <T as ParameterizedSpawn<(T1,)>>::Error>

Source§

impl<T, I> ParameterizedOutput<I> for T
where T: ParameterizedSpawn<I, Output = Child, Error = Error>,

Source§

type Error = Error

Source§

fn output_with( &mut self, input: I, ) -> Result<Output, <T as ParameterizedOutput<I>>::Error>

Source§

impl<T> SpawnExt for T

Source§

fn spawn( &mut self, ) -> Result<<T as ParameterizedSpawn<()>>::Output, <T as ParameterizedSpawn<()>>::Error>

Source§

impl<T, T1> SpawnExt1<T1> for T

Source§

fn spawn( &mut self, a: T1, ) -> Result<<T as ParameterizedSpawn<(T1,)>>::Output, <T as ParameterizedSpawn<(T1,)>>::Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.