Skip to main content

Attribute

Struct Attribute 

Source
pub struct Attribute<S = Standard, T = Unselected> { /* private fields */ }
Expand description

p4 [g-opts] attribute [-e -f -p] -n name [-v value [-T0 | -T1]] files ...: set per-revision attributes on revisions.

p4 [g-opts] attribute [-e -f -p [-T0 | -T1]] -i -n name file

p4 attribute [-f -p [-T0 | -T1]] -I filename -n name file

The S type parameter tracks the value source: Standard for the default -n/-v set-or-clear form, FromStdin for the -i form, FromFile for the -I filename form, and and the T type parameter tracks the -T0/-T1 trait storage location.

Implementations§

Source§

impl Attribute<Standard, Unselected>

Source

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

Creates a new p4 attribute command.

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

Source§

impl<T: ExclusiveOption> Attribute<Standard, T>

Source

pub fn set( &mut self, name: impl Into<String>, value: impl Into<String>, ) -> &mut Self

§Description

-n name -v value

Sets the attribute name to value on the given files. The supplied value must be text.

Source

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

§Description

-n name

Clears the attribute name on the given files by omitting the -v option.

Source

pub fn get_hex(&self) -> bool

§Description

-e

Indicates that the value is specified in hex.

Source

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

§Description

-e

Indicates that the value is specified in hex.

Source

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

§Description

-e

Indicates that the value is specified in hex.

Source

pub fn read_from_stdin(self, name: String) -> Attribute<FromStdin, T>

§Description

-i

Read an attribute value from the standard input. Only one file argument is allowed when using this option. This option supports both textual and binary content.

Transitions this command to the FromStdin state; any -n/-v pairs set with Self::set or Self::clear are discarded, while -e is preserved.

Source

pub fn read_from_file( self, name: String, file: PathBuf, ) -> Attribute<FromFile, T>

§Description

-I filename

Read the attribute value from a file. The file can have textual or binary content. Use this when the attribute data exceeds 250 megabytes, which might cause the command to fail with the Rpc buffer too big error. The following are not allowed with this option:

  • Using the -e option to specify the value as hex.
  • More than one file argument.
  • Setting more than one trait value.

To display attributes set with this option, use the p4 print -T command instead of the p4 fstat -Oa command because p4 print -T can handle larger non-encoded binary data.

Transitions this command to the FromFile state; any -n/-v pairs set with Self::set or Self::clear, as well as -e, are discarded.

Source§

impl<T: ExclusiveOption> Attribute<FromStdin, T>

Source

pub fn get_hex(&self) -> bool

§Description

-e

Indicates that the value is specified in hex.

Source

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

§Description

-e

Indicates that the value is specified in hex.

Source

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

§Description

-e

Indicates that the value is specified in hex.

Source

pub fn get_name(&self) -> &str

§Description

-n name

The name of the attribute read from standard input.

Source

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

§Description

-n name

The name of the attribute read from standard input.

Source

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

§Description

-n name

The name of the attribute read from standard input.

Source

pub fn output<S, V>(&self, file: S, value: V) -> Result<Output, Error>
where S: AsRef<OsStr>, V: AsRef<[u8]>,

Runs p4 attribute -i for a single file, writing value to the child’s standard input, and captures the command’s output.

Unlike ParameterizedSpawn::spawn_with, this method handles writing the attribute value to the child’s standard input itself, so it is the most convenient way to submit values through standard input.

Only one file argument is allowed in the FromStdin state.

Source§

impl<T: ExclusiveOption> Attribute<FromFile, T>

Source

pub fn get_name(&self) -> &str

§Description

-n name

The name of the attribute read from the file.

Source

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

§Description

-n name

The name of the attribute read from the file.

Source

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

§Description

-n name

The name of the attribute read from the file.

Source

pub fn get_file(&self) -> &Path

§Description

-I filename

The file the attribute value is read from.

Source§

impl<S: ExclusiveOption, T: ExclusiveOption> Attribute<S, T>

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_on_submitted_files(&self) -> bool

§Description

-f

Set the attribute on submitted files. If a propagating trait is set on a submitted file, a revision specifier cannot be used, and the file must not be currently open in any workspace.

Source

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

§Description

-f

Set the attribute on submitted files. If a propagating trait is set on a submitted file, a revision specifier cannot be used, and the file must not be currently open in any workspace.

Source

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

§Description

-f

Set the attribute on submitted files. If a propagating trait is set on a submitted file, a revision specifier cannot be used, and the file must not be currently open in any workspace.

Source

pub fn get_propagating(&self) -> bool

§Description

-p

Create a propagating attribute: an attribute whose value is propagated to subsequent revisions whenever the file is opened. Relevant commands include p4 copy, p4 delete, p4 edit, p4 integrate, p4 reconcile, p4 resolve, p4 shelve, p4 submit, and p4 unshelve.

Source

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

§Description

-p

Create a propagating attribute: an attribute whose value is propagated to subsequent revisions whenever the file is opened. Relevant commands include p4 copy, p4 delete, p4 edit, p4 integrate, p4 reconcile, p4 resolve, p4 shelve, p4 submit, and p4 unshelve.

Source

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

§Description

-p

Create a propagating attribute: an attribute whose value is propagated to subsequent revisions whenever the file is opened. Relevant commands include p4 copy, p4 delete, p4 edit, p4 integrate, p4 reconcile, p4 resolve, p4 shelve, p4 submit, and p4 unshelve.

Source§

impl<S: ExclusiveOption, T: ExclusiveOption> Attribute<S, T>

Source

pub fn store_in_database_traits(self) -> Attribute<S, DatabaseTraits>

§Description

-T0

Causes the value to be stored in the db.traits table, which is the implicit default.

Source

pub fn store_in_trait_depot(self) -> Attribute<S, TraitDepot>

§Description

-T1

Causes the value to be stored in the trait depot instead of the db.traits table, even if the size of the attribute value is less than the size specified by the trait.storagedepot.min configurable. However, if trait.storagedepot.min is unset or set to 0, the attribute value is stored in the db.traits table.

Trait Implementations§

Source§

impl<S: Clone, T: Clone> Clone for Attribute<S, T>

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<S: Debug, T: Debug> Debug for Attribute<S, T>

Source§

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

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

impl<S: Default, T: Default> Default for Attribute<S, T>

Source§

fn default() -> Self

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

impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<Standard, T>

Source§

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

Spawns p4 attribute 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.

Source§

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

Source§

type Output<'a> = Child

Source§

type Error = Error

Source§

impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<FromStdin, T>

Source§

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

Spawns p4 attribute -i for a single file as a child process 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 write the attribute value yourself, then drop it before waiting on the child. Only one file argument is allowed in the FromStdin state.

Source§

type Input<'a> = (&'a OsStr, Stdio)

Source§

type Output<'a> = Child

Source§

type Error = Error

Source§

impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<FromFile, T>

Available on non-crate feature lt2024_2 only.
Source§

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

Spawns p4 attribute -I for a single file as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

Only one file argument is allowed in the FromFile state.

Source§

type Input<'a> = &'a OsStr

Source§

type Output<'a> = Child

Source§

type Error = Error

Source§

impl<S: ExclusiveOption, T: ExclusiveOption> SubCommand for Attribute<S, T>

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<S, T> Freeze for Attribute<S, T>
where S: Freeze, T: Freeze,

§

impl<S, T> RefUnwindSafe for Attribute<S, T>

§

impl<S, T> Send for Attribute<S, T>
where S: Send, T: Send,

§

impl<S, T> Sync for Attribute<S, T>
where S: Sync, T: Sync,

§

impl<S, T> Unpin for Attribute<S, T>
where S: Unpin, T: Unpin,

§

impl<S, T> UnsafeUnpin for Attribute<S, T>
where S: UnsafeUnpin, T: UnsafeUnpin,

§

impl<S, T> UnwindSafe for Attribute<S, T>
where S: UnwindSafe, T: 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.