Skip to main content

Change

Struct Change 

Source
pub struct Change<M = Unselected, P = Unselected, C = Unselected, S = Unselected> { /* private fields */ }
Expand description

Type-safe builder for p4 change.

Create or edit a changelist specification.

The command p4 changelist is an alias for p4 change.

§Syntax

p4 [g-opts] change [-s] [-f | -u] [[-O|-I] changelist]
p4 [g-opts] change -d [-f -s -O] changelist
p4 [g-opts] change -o [-s] [-f] [[-O|-I] changelist]
p4 [g-opts] change -i [-s] [-f | -u]
p4 [g-opts] change -t restricted | public [-U user] [-f|-u|-O|-I] changelist
p4 [g-opts] change -U user [-t restricted | public] [-f] changelist
p4 [g-opts] change -d -f --serverid=X changelist

The four type parameters track, independently and at compile time:

Start from Change::new (or crate::P4Cli::change), enter a form with one of Self::delete, Self::stdout, Self::stdin, Self::visibility, or Self::user (or one of the Self::force/Self::update/Self::original/ Self::identity/ Self::arbitrary_job_status entry points that select an option of the plain edit form), and move between compatible forms with the delete, stdout, stdin, visibility, user, and server_id transition methods.

Implementations§

Source§

impl<O, C> Change<DeleteMode<LocalDeleteMode>, O, C, Unselected>

Source

pub fn arbitrary_job_status( self, ) -> Change<DeleteMode<LocalDeleteMode>, O, C, ArbitraryJobStatus>

Selects -s in the delete form.

Source§

impl<C, S> Change<DeleteMode<LocalDeleteMode>, Unselected, C, S>

Source

pub fn force( self, ) -> Change<DeleteMode<LocalDeleteMode>, ForceOperationMode, C, S>

Selects -f in the delete form (forcibly delete a submitted changelist).

Source§

impl<O, S> Change<DeleteMode<LocalDeleteMode>, O, Unselected, S>

Source

pub fn original( self, ) -> Change<DeleteMode<LocalDeleteMode>, O, OriginalChangeListMode, S>

Selects -O in the delete form (reference by original changelist number).

Source§

impl<O: TransferRemoteDeleteMode> Change<DeleteMode<LocalDeleteMode>, O, Unselected, Unselected>

Source

pub fn server_id( self, server_id: impl Into<String>, ) -> Change<DeleteMode<RemoteDeleteMode>, Unselected, Unselected, Unselected>

Transitions to the remote delete form.

Available from the local delete form as long as neither -s, -O, nor -u is selected (the remote delete form accepts no extra options; its -f is built in). A previously selected -f is simply dropped in favor of the built-in one.

server_id is the server id of the commit server the changelist’s client is bound to.

Source§

impl<O, C> Change<StdoutMode, O, C, Unselected>

Source

pub fn arbitrary_job_status( self, ) -> Change<StdoutMode, O, C, ArbitraryJobStatus>

Selects -s in the stdout form.

Source§

impl<C, S> Change<StdoutMode, Unselected, C, S>

Source

pub fn force(self) -> Change<StdoutMode, ForceOperationMode, C, S>

Selects -f in the stdout form.

Source§

impl<O, S> Change<StdoutMode, O, Unselected, S>

Source

pub fn original(self) -> Change<StdoutMode, O, OriginalChangeListMode, S>

Selects -O in the stdout form (reference by original changelist number).

Source

pub fn identity(self) -> Change<StdoutMode, O, IdentityChangeListMode, S>

Selects -I in the stdout form (reference by Identity field).

Source§

impl<O> Change<StdinMode, O, Unselected, Unselected>

Source

pub fn arbitrary_job_status( self, ) -> Change<StdinMode, O, Unselected, ArbitraryJobStatus>

Selects -s in the stdin form.

Source§

impl<S> Change<StdinMode, Unselected, Unselected, S>

Source

pub fn force(self) -> Change<StdinMode, ForceOperationMode, Unselected, S>

Selects -f in the stdin form.

Source

pub fn update(self) -> Change<StdinMode, UpdateOperationMode, Unselected, S>

Selects -u in the stdin form.

Source§

impl<O, C> Change<UserOrVisibilityMode, O, C, Unselected>

Source

pub fn user(self, user: impl Into<String>) -> Self

Sets the new owner (-U user) of the changelist.

user is the user the changelist is transferred to.

Source

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

Sets the new owner (-U user) of the changelist.

user is the user the changelist is transferred to.

Source

pub fn get_user(&self) -> Option<&str>

Returns the new owner (-U user) of the changelist, if set.

Source

pub fn visibility(self, visibility: Visibility) -> Self

Sets the changelist visibility (-t restricted | public).

visibility selects the new changelist type.

Source

pub fn set_visibility(&mut self, visibility: Visibility) -> &mut Self

Sets the changelist visibility (-t restricted | public).

visibility selects the new changelist type.

Source

pub fn get_visibility(&self) -> Option<Visibility>

Returns the changelist visibility (-t restricted | public), if set.

Source§

impl Change<UserOrVisibilityMode, Unselected, Unselected, Unselected>

Source

pub fn force( self, ) -> Change<UserOrVisibilityMode, OnlyForceOperationMode, Unselected, Unselected>

Selects -f (force the type/owner change).

Mutually exclusive with -u, -O, and -I.

Source

pub fn update( self, ) -> Change<UserOrVisibilityMode, OnlyUpdateOperationMode, Unselected, Unselected>

Selects -u (update a submitted changelist).

Mutually exclusive with -f, -O, and -I.

Source

pub fn original( self, ) -> Change<UserOrVisibilityMode, Unselected, OnlyOriginalChangeListMode, Unselected>

Selects -O: interpret the changelist number as the original, pre-renumber number.

Mutually exclusive with -f, -u, and -I.

Source

pub fn identity( self, ) -> Change<UserOrVisibilityMode, Unselected, OnlyIdentityChangeListMode, Unselected>

Selects -I: interpret the changelist number as the Identity field.

Mutually exclusive with -f, -u, and -O.

Source§

impl Change<Unselected, Unselected, Unselected, Unselected>

Source

pub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self

Creates a new p4 change command.

bin is the path to the Perforce command-line executable.

Source

pub fn delete( self, ) -> Change<DeleteMode<LocalDeleteMode>, Unselected, Unselected, Unselected>

Enters the local delete form: p4 change -d changelist.

Source

pub fn server_id( self, server_id: impl Into<String>, ) -> Change<DeleteMode<RemoteDeleteMode>, Unselected, Unselected, Unselected>

Enters the remote delete form.

-f is fixed in this form and is injected together with the form; none of the other options are accepted.

server_id is the server id of the commit server the changelist’s client is bound to.

Source

pub fn stdout(self) -> Change<StdoutMode, Unselected, Unselected, Unselected>

Enters the stdout form: p4 change -o.

Source

pub fn stdin(self) -> Change<StdinMode, Unselected, Unselected, Unselected>

Enters the stdin form: p4 change -i.

Source

pub fn visibility( self, visibility: Visibility, ) -> Change<UserOrVisibilityMode, Unselected, Unselected, Unselected>

Enters the change-type form: p4 change -t restricted | public changelist.

visibility selects the new changelist type; the optional new owner can be added later with the user builder of the entered form.

Source

pub fn user( self, user: impl Into<String>, ) -> Change<UserOrVisibilityMode, Unselected, Unselected, Unselected>

Enters the owner-transfer form: p4 change -U user changelist.

user is the new owner of the empty pending changelist; the optional visibility can be added later with the visibility builder of the entered form.

Source

pub fn arbitrary_job_status( self, ) -> Change<RegularOperationMode, Unselected, Unselected, ArbitraryJobStatus>

Selects -s and enters the plain edit form.

Source

pub fn force( self, ) -> Change<RegularOperationMode, ForceOperationMode, Unselected, Unselected>

Selects -f and enters the plain edit form.

Source

pub fn update( self, ) -> Change<RegularOperationMode, UpdateOperationMode, Unselected, Unselected>

Selects -u and enters the plain edit form.

Source

pub fn original( self, ) -> Change<RegularOperationMode, Unselected, OriginalChangeListMode, Unselected>

Selects -O and enters the plain edit form.

Source

pub fn identity( self, ) -> Change<RegularOperationMode, Unselected, IdentityChangeListMode, Unselected>

Selects -I and enters the plain edit form.

Source§

impl<M, P, C, S> Change<M, P, C, S>

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

Returns the global options of this command.

Source

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

Sets the global options of this command.

Source

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

Builder for the global options of this command.

Source§

impl<P, C, S> Change<RegularOperationMode, P, C, S>

Source

pub fn delete(self) -> Change<DeleteMode<LocalDeleteMode>, P, C, S>
where P: TransferDeleteMode, C: TransferDeleteMode,

Transitions to the local delete form (-d), preserving every selected option accepted by that form.

Available when no -u or -I is selected (-d accepts only -f, -s, and -O).

Source

pub fn stdout(self) -> Change<StdoutMode, P, C, S>
where P: TransferStdoutMode,

Transitions to the stdout form (-o), preserving every selected option accepted by that form.

Available when no -u is selected (-o accepts -f, -s, -O, and -I).

Source§

impl<P: TransferRemoteDeleteMode> Change<RegularOperationMode, P, Unselected, Unselected>

Source

pub fn server_id( self, server_id: impl Into<String>, ) -> Change<DeleteMode<RemoteDeleteMode>, Unselected, Unselected, Unselected>

Transitions to the remote delete form.

Available from the plain edit form as long as neither -u, -s, -O, nor -I is selected. A previously selected -f is folded into the form’s built-in -f.

server_id is the server id of the commit server the changelist’s client is bound to.

Source§

impl<O, S> Change<RegularOperationMode, O, Unselected, S>

Source

pub fn stdin(self) -> Change<StdinMode, O, Unselected, S>

Transitions to the stdin form (-i), preserving every selected option accepted by that form.

Available only when no -O or -I is selected (-i accepts -s, -f, and -u, but no changelist reference).

Source§

impl<O, C> Change<RegularOperationMode, O, C, Unselected>

Source

pub fn arbitrary_job_status( self, ) -> Change<RegularOperationMode, O, C, ArbitraryJobStatus>

Selects -s: jobs may be assigned arbitrary status values on submission.

Source§

impl<C, S> Change<RegularOperationMode, Unselected, C, S>

Source

pub fn force(self) -> Change<RegularOperationMode, ForceOperationMode, C, S>

Selects -f (force editing of submitted changelists).

Mutually exclusive with -u.

Source

pub fn update(self) -> Change<RegularOperationMode, UpdateOperationMode, C, S>

Selects -u (update a submitted changelist).

Mutually exclusive with -f.

Source§

impl<O, S> Change<RegularOperationMode, O, Unselected, S>

Source

pub fn original( self, ) -> Change<RegularOperationMode, O, OriginalChangeListMode, S>

Selects -O: interpret the changelist number as the original, pre-renumber number.

Mutually exclusive with -I.

Source

pub fn identity( self, ) -> Change<RegularOperationMode, O, IdentityChangeListMode, S>

Selects -I: interpret the changelist number as the Identity field.

Mutually exclusive with -O.

Source§

impl<O, C> Change<RegularOperationMode, O, C, Unselected>

Source

pub fn visibility( self, visibility: Visibility, ) -> Change<UserOrVisibilityMode, <(O, C) as TransferUVMode>::P, <(O, C) as TransferUVMode>::C, Unselected>
where (O, C): TransferUVMode,

Transitions to the change-type form (-t type), preserving a selected -f, -u, -O, or -I as the form’s single allowed extra option.

Available only when -s is not selected (the -t / -U form does not accept it), and at most one of -f, -u, -O, -I is selected.

visibility selects the new changelist type.

Source

pub fn user( self, user: impl Into<String>, ) -> Change<UserOrVisibilityMode, <(O, C) as TransferUVMode>::P, <(O, C) as TransferUVMode>::C, Unselected>
where (O, C): TransferUVMode,

Transitions to the owner-transfer form (-U user), preserving a selected -f, -u, -O, or -I as the form’s single allowed extra option.

Available only when -s is not selected (the -t / -U form does not accept it), and at most one of -f, -u, -O, -I is selected.

user is the new owner of the empty pending changelist.

Trait Implementations§

Source§

impl<M: Clone, P: Clone, C: Clone, S: Clone> Clone for Change<M, P, C, S>

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, P: Debug, C: Debug, S: Debug> Debug for Change<M, P, C, S>

Source§

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

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

impl<M: Default, P: Default, C: Default, S: Default> Default for Change<M, P, C, S>

Source§

fn default() -> Self

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

impl<O, C, S> ParameterizedSpawn<()> for Change<RegularOperationMode, O, C, S>

Source§

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

Spawns p4 change (the plain edit form) without a changelist argument, opening the editor to create a new pending changelist.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<O, C, S> ParameterizedSpawn<()> for Change<StdoutMode, O, C, S>

Source§

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

Spawns p4 change -o without a changelist argument, writing the default changelist specification to standard output.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<O, S> ParameterizedSpawn<()> for Change<StdinMode, O, Unselected, S>

Source§

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

Spawns p4 change -i with a piped standard input stream (and piped standard output and error streams); write the changelist specification to the returned Child’s stdin handle.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<M, O, C, S, I> ParameterizedSpawn<(I,)> for Change<M, O, C, S>
where M: ExclusiveOption + TakesChangeList, O: ExclusiveOption, C: ExclusiveOption, S: ExclusiveOption, I: AsRef<OsStr>,

Source§

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

Spawns p4 change with the given changelist 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.

The changelist argument is a changelist number, optionally prefixed by the form’s reference option semantics (for example an original pre-renumber number under -O).

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<O, S> ParameterizedSpawn<(Stdio,)> for Change<StdinMode, O, Unselected, S>

Source§

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

Spawns p4 change -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 changelist 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, O, C, S> SubCommand for Change<M, O, C, S>

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, P, C, S> Freeze for Change<M, P, C, S>
where M: Freeze, P: Freeze, C: Freeze, S: Freeze,

§

impl<M, P, C, S> RefUnwindSafe for Change<M, P, C, S>

§

impl<M, P, C, S> Send for Change<M, P, C, S>
where M: Send, P: Send, C: Send, S: Send,

§

impl<M, P, C, S> Sync for Change<M, P, C, S>
where M: Sync, P: Sync, C: Sync, S: Sync,

§

impl<M, P, C, S> Unpin for Change<M, P, C, S>
where M: Unpin, P: Unpin, C: Unpin, S: Unpin,

§

impl<M, P, C, S> UnsafeUnpin for Change<M, P, C, S>

§

impl<M, P, C, S> UnwindSafe for Change<M, P, C, S>

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.