Skip to main content

Edit

Struct Edit 

Source
pub struct Edit<M = Unselected> { /* private fields */ }
Expand description

p4 [g-opts] edit [-c changelist] [-k -n] [-t type] [--remote=remote] file ...

p4 [g-opts] edit -So [-c changelist]

Opens files in a client workspace for edit, or open the current stream spec.

The M type parameter tracks the command form at compile time. The default Unselected state opens plain files with no edit-mode options; Self::keep_workspace, Self::preview, Self::remote_server, and Self::filetype transition to the FileEditMode state, while Self::edit_stream_spec transitions to the StreamSpecEditMode state.

Implementations§

Source§

impl Edit<Unselected>

Source

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

Creates a new p4 edit command.

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

Source

pub fn keep_workspace(self, v: bool) -> Edit<FileEditMode>

§Description

-k

Keep existing workspace files; mark the file as open for edit even if the file is not in the client view. Use p4 edit -k only in the context of reconciling work performed while disconnected from the shared versioning service.

Transitions this command to the FileEditMode state.

Source

pub fn preview(self, v: bool) -> Edit<FileEditMode>

§Description

-n

Preview which files would be opened for edit, without actually changing any files or metadata.

Transitions this command to the FileEditMode state.

Source

pub fn remote_server(self, v: impl Into<String>) -> Edit<FileEditMode>

§Description

--remote=remote

Opens the file for edit in your personal server, and additionally — if the file is of type +l — takes a global exclusive lock on the file in the shared server from which you cloned the file.

Transitions this command to the FileEditMode state.

Source

pub fn filetype(self, v: impl Into<String>) -> Edit<FileEditMode>

§Description

-t type

Stores the new file revision as the specified type, overriding the file type of the previous revision of the same file. To forcibly re-detect a file’s filetype upon editing a file, use p4 edit -t auto. This assigns a file type as if the file were being newly added.

See File types as well as the lbr.autocompress configurable.

Transitions this command to the FileEditMode state.

Source

pub fn edit_stream_spec(self) -> Edit<StreamSpecEditMode>

§Description

-So

Can be used with -c changelist to open the client’s stream spec for edit. No list of files is allowed. p4 edit -So is an alias for p4 stream edit (see also p4 help streamcmds).

Transitions this command to the StreamSpecEditMode state.

Source§

impl Edit<FileEditMode>

Source

pub fn get_keep_workspace(&self) -> bool

§Description

-k

Keep existing workspace files; mark the file as open for edit even if the file is not in the client view. Use p4 edit -k only in the context of reconciling work performed while disconnected from the shared versioning service.

Source

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

§Description

-k

Keep existing workspace files; mark the file as open for edit even if the file is not in the client view. Use p4 edit -k only in the context of reconciling work performed while disconnected from the shared versioning service.

Source

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

§Description

-k

Keep existing workspace files; mark the file as open for edit even if the file is not in the client view. Use p4 edit -k only in the context of reconciling work performed while disconnected from the shared versioning service.

Source

pub fn get_preview(&self) -> bool

§Description

-n

Preview which files would be opened for edit, without actually changing any files or metadata.

Source

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

§Description

-n

Preview which files would be opened for edit, without actually changing any files or metadata.

Source

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

§Description

-n

Preview which files would be opened for edit, without actually changing any files or metadata.

Source

pub fn get_remote_server(&self) -> Option<&String>

§Description

--remote=remote

Opens the file for edit in your personal server, and additionally — if the file is of type +l — takes a global exclusive lock on the file in the shared server from which you cloned the file.

Source

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

§Description

--remote=remote

Opens the file for edit in your personal server, and additionally — if the file is of type +l — takes a global exclusive lock on the file in the shared server from which you cloned the file.

Source

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

§Description

--remote=remote

Opens the file for edit in your personal server, and additionally — if the file is of type +l — takes a global exclusive lock on the file in the shared server from which you cloned the file.

Source

pub fn get_filetype(&self) -> Option<&String>

§Description

-t type

Stores the new file revision as the specified type, overriding the file type of the previous revision of the same file. To forcibly re-detect a file’s filetype upon editing a file, use p4 edit -t auto. This assigns a file type as if the file were being newly added.

See File types as well as the lbr.autocompress configurable.

Source

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

§Description

-t type

Stores the new file revision as the specified type, overriding the file type of the previous revision of the same file. To forcibly re-detect a file’s filetype upon editing a file, use p4 edit -t auto. This assigns a file type as if the file were being newly added.

See File types as well as the lbr.autocompress configurable.

Source

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

§Description

-t type

Stores the new file revision as the specified type, overriding the file type of the previous revision of the same file. To forcibly re-detect a file’s filetype upon editing a file, use p4 edit -t auto. This assigns a file type as if the file were being newly added.

See File types as well as the lbr.autocompress configurable.

Source§

impl<M: ExclusiveOption> Edit<M>

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

pub fn get_change_list(&self) -> Option<&String>

§Description

-c changelist

Opens the files for edit within the specified changelist. If this option is not provided, the files are linked to the default changelist.

Source

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

§Description

-c changelist

Opens the files for edit within the specified changelist. If this option is not provided, the files are linked to the default changelist.

Source

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

§Description

-c changelist

Opens the files for edit within the specified changelist. If this option is not provided, the files are linked to the default changelist.

Trait Implementations§

Source§

impl<M: Clone> Clone for Edit<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 Edit<M>

Source§

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

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

impl<M: Default> Default for Edit<M>

Source§

fn default() -> Self

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

impl ParameterizedSpawn for Edit<Unselected>

Source§

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

Spawns p4 edit for the given files as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

This corresponds to the file form of the command: p4 edit [options] file ....

Source§

type Input<'a> = &'a [&'a OsStr]

Source§

type Output<'a> = Child

Source§

type Error = Error

Source§

impl ParameterizedSpawn for Edit<FileEditMode>

Source§

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

Spawns p4 edit for the given files as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

This corresponds to the file form of the command: p4 edit [options] file ....

Source§

type Input<'a> = &'a [&'a OsStr]

Source§

type Output<'a> = Child

Source§

type Error = Error

Source§

impl ParameterizedSpawn for Edit<StreamSpecEditMode>

Available on non-crate feature lt2019_1 only.
Source§

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

Spawns p4 edit -So to open the current stream spec for edit as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

This corresponds to the stream spec form of the command: p4 edit -So [-c changelist], which takes no file arguments.

Source§

type Input<'a> = ()

Source§

type Output<'a> = Child

Source§

type Error = Error

Source§

impl<M: ExclusiveOption> SubCommand for Edit<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 Edit<M>
where M: Freeze,

§

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

§

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

§

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

§

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

§

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

§

impl<M> UnwindSafe for Edit<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: for<'a> SpawnExt<Output<'a> = Child, Error = Error>,

Source§

impl<T, T1> OutputExt1<T1> for T
where T: for<'a> ParameterizedOutput<Input<'a> = T1>,

Source§

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

Source§

impl<T, T1, T2> OutputExt2<T1, T2> for T
where T: for<'a> ParameterizedOutput<Input<'a> = (T1, T2)>,

Source§

fn output<'a>( &mut self, a: T1, b: T2, ) -> Result<Output, <T as ParameterizedOutput>::Error>
where T1: 'a, T2: 'a,

Source§

impl<T, T1, T2, T3> OutputExt3<T1, T2, T3> for T
where T: for<'a> ParameterizedOutput<Input<'a> = (T1, T2, T3)>,

Source§

fn output<'a>( &mut self, a: T1, b: T2, c: T3, ) -> Result<Output, <T as ParameterizedOutput>::Error>
where T1: 'a, T2: 'a, T3: 'a,

Source§

impl<T, T1, T2, T3, T4> OutputExt4<T1, T2, T3, T4> for T
where T: for<'a> ParameterizedOutput<Input<'a> = (T1, T2, T3, T4)>,

Source§

fn output<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, ) -> Result<Output, <T as ParameterizedOutput>::Error>
where T1: 'a, T2: 'a, T3: 'a, T4: 'a,

Source§

impl<T, T1, T2, T3, T4, T5> OutputExt5<T1, T2, T3, T4, T5> for T
where T: for<'a> ParameterizedOutput<Input<'a> = (T1, T2, T3, T4, T5)>,

Source§

fn output<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, e: T5, ) -> Result<Output, <T as ParameterizedOutput>::Error>
where T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a,

Source§

impl<T, T1, T2, T3, T4, T5, T6> OutputExt6<T1, T2, T3, T4, T5, T6> for T
where T: for<'a> ParameterizedOutput<Input<'a> = (T1, T2, T3, T4, T5, T6)>,

Source§

fn output<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, ) -> Result<Output, <T as ParameterizedOutput>::Error>
where T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a,

Source§

impl<T, T1, T2, T3, T4, T5, T6, T7> OutputExt7<T1, T2, T3, T4, T5, T6, T7> for T
where T: for<'a> ParameterizedOutput<Input<'a> = (T1, T2, T3, T4, T5, T6, T7)>,

Source§

fn output<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, ) -> Result<Output, <T as ParameterizedOutput>::Error>
where T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a, T7: 'a,

Source§

impl<T, T1, T2, T3, T4, T5, T6, T7, T8> OutputExt8<T1, T2, T3, T4, T5, T6, T7, T8> for T

Source§

fn output<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, ) -> Result<Output, <T as ParameterizedOutput>::Error>
where T1: 'a, T2: 'a, T3: 'a, T4: 'a, T5: 'a, T6: 'a, T7: 'a, T8: 'a,

Source§

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

Source§

type Input<'a> = <T as ParameterizedSpawn>::Input<'a>

Source§

type Error = Error

Source§

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

Source§

impl<T> SpawnExt for T
where T: for<'a> ParameterizedSpawn<Input<'a> = ()>,

Source§

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

Source§

impl<T, T1> SpawnExt1<T1> for T
where T: for<'a> ParameterizedSpawn<Input<'a> = T1>,

Source§

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

Source§

impl<T, T1, T2> SpawnExt2<T1, T2> for T
where T: for<'a> ParameterizedSpawn<Input<'a> = (T1, T2)>,

Source§

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

Source§

impl<T, T1, T2, T3> SpawnExt3<T1, T2, T3> for T
where T: for<'a> ParameterizedSpawn<Input<'a> = (T1, T2, T3)>,

Source§

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

Source§

impl<T, T1, T2, T3, T4> SpawnExt4<T1, T2, T3, T4> for T
where T: for<'a> ParameterizedSpawn<Input<'a> = (T1, T2, T3, T4)>,

Source§

fn spawn<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, ) -> Result<<T as ParameterizedSpawn>::Output<'a>, <T as ParameterizedSpawn>::Error>

Source§

impl<T, T1, T2, T3, T4, T5> SpawnExt5<T1, T2, T3, T4, T5> for T
where T: for<'a> ParameterizedSpawn<Input<'a> = (T1, T2, T3, T4, T5)>,

Source§

fn spawn<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, e: T5, ) -> Result<<T as ParameterizedSpawn>::Output<'a>, <T as ParameterizedSpawn>::Error>

Source§

impl<T, T1, T2, T3, T4, T5, T6> SpawnExt6<T1, T2, T3, T4, T5, T6> for T
where T: for<'a> ParameterizedSpawn<Input<'a> = (T1, T2, T3, T4, T5, T6)>,

Source§

fn spawn<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, ) -> Result<<T as ParameterizedSpawn>::Output<'a>, <T as ParameterizedSpawn>::Error>

Source§

impl<T, T1, T2, T3, T4, T5, T6, T7> SpawnExt7<T1, T2, T3, T4, T5, T6, T7> for T
where T: for<'a> ParameterizedSpawn<Input<'a> = (T1, T2, T3, T4, T5, T6, T7)>,

Source§

fn spawn<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, ) -> Result<<T as ParameterizedSpawn>::Output<'a>, <T as ParameterizedSpawn>::Error>

Source§

impl<T, T1, T2, T3, T4, T5, T6, T7, T8> SpawnExt8<T1, T2, T3, T4, T5, T6, T7, T8> for T

Source§

fn spawn<'a>( &mut self, a: T1, b: T2, c: T3, d: T4, e: T5, f: T6, g: T7, h: T8, ) -> Result<<T as ParameterizedSpawn>::Output<'a>, <T as ParameterizedSpawn>::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.