Skip to main content

Client

Struct Client 

Source
pub struct Client<M = GeneralMode, F = Unselected, T = Unselected, W = Unselected> { /* private fields */ }
Expand description
p4 client [-f] [-t template] [-T type] [name]
p4 client -d [-f [-Fs|-Fd]] name
p4 client -o [-t template] [-T type] [name]
p4 client -S stream [[-c change] -o] [name]
p4 client -s [-f] -S stream [name]
p4 client -s [-f] -t template [name]
p4 client -i [-f]
p4 client -d -f --serverid=X [-Fs] name

Create or edit a client workspace specification and its view.

The type parameters track the mode M and the orthogonal option dimensions F (-f), T (-t template), and W (-T type) at compile time, so a transition is only available when every option already set is valid in the target form:

Implementations§

Source§

impl Client<GeneralMode, Unselected, Unselected, Unselected>

Source

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

Creates a new p4 client command in the GeneralMode state.

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

Source§

impl<M, F, T, W> Client<M, F, T, W>

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

Get the global options.

Source

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

Set the global options.

Source

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

Set the global options.

Source§

impl<T, W> Client<GeneralMode, Unselected, T, W>

Source

pub fn force(self) -> Client<GeneralMode, ForceSet, T, W>

§Description

-f

Allows the last modification date, which is normally read-only, to be set. Administrators can use the -f option to delete or modify locked workspaces owned by other users. Use of this option requires admin access granted by p4 protect.

Source§

impl<I, S> Client<DeleteMode<I, S>, Unselected, Unselected, Unselected>
where I: ServerIdState, S: ShelvedState,

Source

pub fn force(self) -> Client<DeleteMode<I, S>, ForceSet, Unselected, Unselected>

§Description

-f

The combination of -d with -f allows the P4 Server administrator to delete a locked workspace that is owned by other user. This also reverts any files opened on the workspace.

-f is required by the -Fs, -Fd, and --serverid=X options, but it may be selected before or after them; calling force on a state carrying those options completes the documented form and makes the command spawnable.

Source§

impl<V> Client<SwitchViewMode<V>, Unselected, Unselected, Unselected>

Source

pub fn force( self, ) -> Client<SwitchViewMode<V>, ForceSet, Unselected, Unselected>

§Description

-f

The -f option can be used with -s to force switching with opened files.

Source§

impl Client<StdinMode, Unselected, Unselected, Unselected>

Source

pub fn force(self) -> Client<StdinMode, ForceSet, Unselected, Unselected>

§Description

-f

Allows the last modification date, which is normally read-only, to be set. Use of this option requires admin access granted by p4 protect.

Source§

impl<F, W> Client<GeneralMode, F, Unselected, W>

Source

pub fn template( self, template: impl Into<String>, ) -> Client<GeneralMode, F, TemplateSet, W>

§Description

-t name

Copy client workspace template’s view and options into the View: and Options: field of this workspace. If you specify a default client template using the template.client configurable, you do not have to specify this option.

Source§

impl<W> Client<StdoutMode, Unselected, Unselected, W>

Source

pub fn template( self, template: impl Into<String>, ) -> Client<StdoutMode, Unselected, TemplateSet, W>

§Description

-t name

Copy client workspace template’s view and options into the View: and Options: field of this workspace.

Source§

impl<F, T> Client<GeneralMode, F, T, Unselected>

Source

pub fn workspace_type( self, workspace_type: WorkSpaceType, ) -> Client<GeneralMode, F, T, TypeSet>

§Description

-T type

By default, clients are writeable. When you create a client workspace, use -T type to set a specific type.

Source§

impl<T> Client<StdoutMode, Unselected, T, Unselected>

Source

pub fn workspace_type( self, workspace_type: WorkSpaceType, ) -> Client<StdoutMode, Unselected, T, TypeSet>

§Description

-T type

By default, clients are writeable. When you create a client workspace, use -T type to set a specific type.

Source§

impl<M, F, W> Client<M, F, TemplateSet, W>

Source

pub fn get_template(&self) -> &str

Get the template client workspace name set with -t.

Source

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

§Description

-t name

Copy client workspace template’s view and options into the View: and Options: field of this workspace.

Source§

impl<M, F, T> Client<M, F, T, TypeSet>

Source

pub fn get_workspace_type(&self) -> WorkSpaceType

Get the client workspace type set with -T.

Source

pub fn set_workspace_type(&mut self, workspace_type: WorkSpaceType) -> &mut Self

§Description

-T type

By default, clients are writeable. When you create a client workspace, use -T type to set a specific type.

Source§

impl<F> Client<GeneralMode, F, Unselected, Unselected>

Source

pub fn delete( self, ) -> Client<DeleteMode<Unselected, Unselected>, F, Unselected, Unselected>

§Description

-d name

Delete the specified client workspace whether or not the workspace is owned by the user. The workspace must be unlocked and must have no opened files or pending changes.

This transitions into the terminal DeleteMode state, from which no further mode transitions are possible.

Source

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

§Description

-i

Read the client workspace specification from standard input.

This transitions into the StdinMode state, carrying the -f option.

Source

pub fn switch_view_stream( self, stream: impl Into<String>, ) -> Client<SwitchViewMode<StreamSwitch>, F, Unselected, Unselected>

§Description

-s -S stream

Switch the workspace view to the specified stream.

This transitions into the SwitchViewMode state, carrying the -f option.

Source

pub fn switch_view_template( self, template: impl Into<String>, ) -> Client<SwitchViewMode<TemplateSwitch>, F, Unselected, Unselected>

§Description

-s -t template

Switch the workspace view to the view defined for another workspace.

This transitions into the SwitchViewMode state, carrying the -f option.

Source§

impl<F> Client<GeneralMode, F, TemplateSet, Unselected>

Source

pub fn switch_view( self, ) -> Client<SwitchViewMode<TemplateSwitch>, F, Unselected, Unselected>

§Description

-s -t template

Switch the workspace view to the view defined for the template workspace already selected with Client::template.

This transitions into the SwitchViewMode state, carrying the -f option.

Source§

impl<T, W> Client<GeneralMode, Unselected, T, W>

Source

pub fn stdout(self) -> Client<StdoutMode, Unselected, T, W>

§Description

-o

Write the client workspace specification to standard output.

This transitions into the StdoutMode state, carrying the -t and -T options.

Source§

impl Client<GeneralMode, Unselected, Unselected, Unselected>

Source

pub fn stream( self, stream: impl Into<String>, ) -> Client<StreamMode<Unselected>, Unselected, Unselected, Unselected>

§Description

-S stream

Associates the workspace with the specified stream, which is used to generate its workspace view.

This transitions into the StreamMode state.

Source§

impl<F> Client<GeneralMode, F, Unselected, Unselected>
where F: ExclusiveOption,

Source

pub fn server_id( self, server_id: impl Into<String>, ) -> Client<DeleteMode<ServerIdSet, Unselected>, F, Unselected, Unselected>

§Description

-d [-f] –serverid=X

If you try to forcibly delete a client bound to another server, you need to specify the --serverid option and specify the server id of the other server. This ensures that you do not accidentally delete the client believing it to be connected to your own server. This variant of the p4 client command must be issued directly to the commit server.

Selecting this option implies -d; -f may be selected before or after it. The resulting command is spawnable only once -f is set.

Source

pub fn keep_shelved( self, ) -> Client<DeleteMode<Unselected, ShelvedKept>, F, Unselected, Unselected>

§Description

-d [-f] -Fs

Allows the deletion with -d of a client even when that client contains shelved changes. The client is deleted and the shelved changes are left intact. (You must use the -f option with the -Fs option.)

Selecting this option implies -d; -f may be selected before or after it. The resulting command is spawnable only once -f is set.

Source

pub fn delete_shelved( self, ) -> Client<DeleteMode<Unselected, ShelvedDeleted>, F, Unselected, Unselected>

§Description

-d [-f] -Fd

Allows the deletion with -d of a client even when that client contains shelved changes. The client and the shelved changes are both deleted. (You must use the -f option with the -Fd option.)

Selecting this option implies -d; -f may be selected before or after it. The resulting command is spawnable only once -f is set.

Source§

impl<S, F> Client<DeleteMode<Unselected, S>, F, Unselected, Unselected>
where S: ServerIdCompatible, F: ExclusiveOption,

Source

pub fn server_id( self, server_id: impl Into<String>, ) -> Client<DeleteMode<ServerIdSet, S>, F, Unselected, Unselected>

§Description

–serverid=X

If you try to forcibly delete a client bound to another server, you need to specify the --serverid option and specify the server id of the other server. This ensures that you do not accidentally delete the client believing it to be connected to your own server. This variant of the p4 client command must be issued directly to the commit server.

Only the -Fs shelved handling can be combined with --serverid; this transition is not available once -Fd has been selected. The required -f may be selected before or afterwards.

Source§

impl<S, F> Client<DeleteMode<ServerIdSet, S>, F, Unselected, Unselected>
where S: ServerIdCompatible, F: ExclusiveOption,

Source

pub fn get_server_id(&self) -> &str

Get the server ID set with --serverid=X.

Source

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

§Description

–serverid=X

Update the server ID of the other server to which the deleted client workspace is bound.

Source§

impl<I, S, F> Client<DeleteMode<I, S>, F, Unselected, Unselected>
where I: ServerIdState, S: ShelvedState, F: ExclusiveOption,

Source

pub fn get_shelved(&self) -> Option<ShelvedHandling>

Get how shelved changes of the deleted client workspace are handled.

Source§

impl<I, F> Client<DeleteMode<I, Unselected>, F, Unselected, Unselected>
where I: ServerIdState, F: ExclusiveOption,

Source

pub fn keep_shelved( self, ) -> Client<DeleteMode<I, ShelvedKept>, F, Unselected, Unselected>

§Description

-Fs

Allows the deletion with -d of a client even when that client contains shelved changes. The client is deleted and the shelved changes are left intact. (You must use the -f option with the -Fs option.)

After this transition neither -Fs nor -Fd can be selected again; the required -f may be selected before or afterwards.

Source§

impl<F> Client<DeleteMode<Unselected, Unselected>, F, Unselected, Unselected>
where F: ExclusiveOption,

Source

pub fn delete_shelved( self, ) -> Client<DeleteMode<Unselected, ShelvedDeleted>, F, Unselected, Unselected>

§Description

-Fd

Allows the deletion with -d of a client even when that client contains shelved changes. The client and the shelved changes are both deleted. (You must use the -f option with the -Fd option.)

This is the terminal shelved state: it cannot be combined with --serverid=X, and neither -Fs nor -Fd can be selected again; the required -f may be selected before or afterwards.

Source§

impl<O> Client<StreamMode<O>, Unselected, Unselected, Unselected>

Source

pub fn get_stream(&self) -> &str

Get the stream set with -S.

Source

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

§Description

-S stream

Associates the workspace with the specified stream, which is used to generate its workspace view.

Source

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

§Description

-S stream

Associates the workspace with the specified stream, which is used to generate its workspace view.

Source§

impl Client<StreamMode<Unselected>, Unselected, Unselected, Unselected>

Source

pub fn switch_view( self, ) -> Client<SwitchViewMode<StreamSwitch>, Unselected, Unselected, Unselected>

§Description

-s -S stream

Switch the workspace view to the stream already selected with Client::stream, changing the stream associated with the workspace.

This transitions into the SwitchViewMode state. The intermediate -S stream form does not accept -f; the optional -f can be added after this transition with Client::force.

Source

pub fn stdout( self, ) -> Client<StreamMode<StdoutOutput>, Unselected, Unselected, Unselected>

§Description

-o

When used with -S stream, displays the workspace specification that would have been created for the stream.

Unlocks the Client::change option.

Source§

impl Client<StreamMode<StdoutOutput>, Unselected, Unselected, Unselected>

Source

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

Get the changelist number set with -c.

Source

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

§Description

-c change

When used with -S stream and -o, displays the workspace specification that would have been created for a stream at the moment the change was submitted.

Source

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

§Description

-c change

When used with -S stream and -o, displays the workspace specification that would have been created for a stream at the moment the change was submitted.

Source§

impl<F> Client<SwitchViewMode<StreamSwitch>, F, Unselected, Unselected>

Source

pub fn get_stream(&self) -> &str

Get the stream the workspace view is switched to.

Source

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

§Description

-S stream

Switch the workspace view to the specified stream.

Source

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

§Description

-S stream

Switch the workspace view to the specified stream.

Source§

impl<F> Client<SwitchViewMode<TemplateSwitch>, F, Unselected, Unselected>

Source

pub fn get_template(&self) -> &str

Get the template workspace whose view is switched to.

Source

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

§Description

-t template

Switch the workspace view to the view defined for another workspace.

Source

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

§Description

-t template

Switch the workspace view to the view defined for another workspace.

Trait Implementations§

Source§

impl<M: Clone, F: Clone, T: Clone, W: Clone> Clone for Client<M, F, T, W>

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, F: Debug, T: Debug, W: Debug> Debug for Client<M, F, T, W>

Source§

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

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

impl<M: Default, F: Default, T: Default, W: Default> Default for Client<M, F, T, W>

Source§

fn default() -> Self

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

impl<F, T, W> ParameterizedSpawn<()> for Client<GeneralMode, F, T, W>

Source§

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

Spawns p4 client for the workspace named by P4CLIENT as a child process; the editor configured by P4EDITOR is invoked on the client workspace specification form.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<T, W> ParameterizedSpawn<()> for Client<StdoutMode, Unselected, T, W>

Source§

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

Spawns p4 client -o for the workspace named by P4CLIENT as a child process, writing the client workspace specification to standard output.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<O> ParameterizedSpawn<()> for Client<StreamMode<O>, Unselected, Unselected, Unselected>
where O: ExclusiveOption,

Source§

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

Spawns p4 client -S stream for the workspace named by P4CLIENT as a child process, associating the workspace with the stream.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<V, F> ParameterizedSpawn<()> for Client<SwitchViewMode<V>, F, Unselected, Unselected>

Source§

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

Spawns p4 client -s for the workspace named by P4CLIENT as a child process, switching its view.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<F> ParameterizedSpawn<()> for Client<StdinMode, F, Unselected, Unselected>
where F: ExclusiveOption,

Source§

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

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

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<I, S, F, A> ParameterizedSpawn<(A,)> for Client<DeleteMode<I, S>, F, Unselected, Unselected>
where I: ServerIdState, S: ShelvedState, F: ExclusiveOption, (I, S, F): ValidDeleteCombination, A: AsRef<OsStr>,

Source§

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

Spawns p4 client -d for the named workspace as a child process.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<F, T, W, I> ParameterizedSpawn<(I,)> for Client<GeneralMode, F, T, W>

Source§

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

Spawns p4 client for the named workspace as a child process; the editor configured by P4EDITOR is invoked on the client workspace specification form.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<T, W, I> ParameterizedSpawn<(I,)> for Client<StdoutMode, Unselected, T, W>

Source§

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

Spawns p4 client -o for the named workspace as a child process, writing the client workspace specification to standard output.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<O, I> ParameterizedSpawn<(I,)> for Client<StreamMode<O>, Unselected, Unselected, Unselected>
where O: ExclusiveOption, I: AsRef<OsStr>,

Source§

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

Spawns p4 client -S stream for the named workspace as a child process, associating the workspace with the stream.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<V, F, I> ParameterizedSpawn<(I,)> for Client<SwitchViewMode<V>, F, Unselected, Unselected>

Source§

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

Spawns p4 client -s for the named workspace as a child process, switching its view.

The child process has its standard output and error streams piped; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<F> ParameterizedSpawn<(Stdio,)> for Client<StdinMode, F, Unselected, Unselected>
where F: ExclusiveOption,

Source§

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

Spawns p4 client -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 client workspace 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, F, T, W> SubCommand for Client<M, F, T, W>
where M: ClientMode<F, T, W>,

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, F, T, W> Freeze for Client<M, F, T, W>
where M: Freeze, F: Freeze, T: Freeze, W: Freeze,

§

impl<M, F, T, W> RefUnwindSafe for Client<M, F, T, W>

§

impl<M, F, T, W> Send for Client<M, F, T, W>
where M: Send, F: Send, T: Send, W: Send,

§

impl<M, F, T, W> Sync for Client<M, F, T, W>
where M: Sync, F: Sync, T: Sync, W: Sync,

§

impl<M, F, T, W> Unpin for Client<M, F, T, W>
where M: Unpin, F: Unpin, T: Unpin, W: Unpin,

§

impl<M, F, T, W> UnsafeUnpin for Client<M, F, T, W>

§

impl<M, F, T, W> UnwindSafe for Client<M, F, T, W>

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.