dicom_core::ops

Enum AttributeAction

Source
#[non_exhaustive]
pub enum AttributeAction {
Show 17 variants Remove, Empty, SetVr(VR), Set(PrimitiveValue), SetStr(Cow<'static, str>), SetIfMissing(PrimitiveValue), SetStrIfMissing(Cow<'static, str>), Replace(PrimitiveValue), ReplaceStr(Cow<'static, str>), PushStr(Cow<'static, str>), PushI32(i32), PushU32(u32), PushI16(i16), PushU16(u16), PushF32(f32), PushF64(f64), Truncate(usize),
}
Expand description

Descriptor for the kind of action to apply over an attribute.

See the module-level documentation for more details.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Remove

Remove the attribute if it exists.

Do nothing otherwise.

§

Empty

If the attribute exists, clear its value to zero bytes.

§

SetVr(VR)

If the attribute exists, set or provide a hint about the attribute’s value representation.

The underlying value is not modified. Implementations are free to ignore this request if it cannot be done or it does not make sense for the given implementation.

§

Set(PrimitiveValue)

Fully reset the attribute with the given DICOM value, creating it if it does not exist yet.

For objects supporting nested data sets, passing PrimitiveValue::Empty will create an empty data set sequence.

§

SetStr(Cow<'static, str>)

Fully reset a textual attribute with the given string, creating it if it does not exist yet.

§

SetIfMissing(PrimitiveValue)

Provide the attribute with the given DICOM value, if it does not exist yet.

For objects supporting nested data sets, passing PrimitiveValue::Empty will create an empty data set sequence.

§

SetStrIfMissing(Cow<'static, str>)

Provide the textual attribute with the given string, creating it if it does not exist yet.

§

Replace(PrimitiveValue)

Fully replace the value with the given DICOM value, but only if the attribute already exists.

For objects supporting nested data sets, passing PrimitiveValue::Empty will clear the items of an existing data set sequence.

§

ReplaceStr(Cow<'static, str>)

Fully replace a textual value with the given string, but only if the attribute already exists.

§

PushStr(Cow<'static, str>)

Append a string as an additional textual value, creating the attribute if it does not exist yet.

New value items are recorded as separate text values, meaning that they are delimited by a backslash (\) at encoding time, regardless of the value representation.

§

PushI32(i32)

Append a 32-bit signed integer as an additional numeric value, creating the attribute if it does not exist yet.

§

PushU32(u32)

Append a 32-bit unsigned integer as an additional numeric value, creating the attribute if it does not exist yet.

§

PushI16(i16)

Append a 16-bit signed integer as an additional numeric value, creating the attribute if it does not exist yet.

§

PushU16(u16)

Append a 16-bit unsigned integer as an additional numeric value, creating the attribute if it does not exist yet.

§

PushF32(f32)

Append a 32-bit floating point number as an additional numeric value, creating the attribute if it does not exist yet.

§

PushF64(f64)

Append a 64-bit floating point number as an additional numeric value, creating the attribute if it does not exist yet.

§

Truncate(usize)

Truncate a value or a sequence to the given number of items, removing extraneous items from the end of the list.

On primitive values, this truncates the value by the number of individual value items (note that bytes in a PrimitiveValue::U8 are treated as individual items). On data set sequences and pixel data fragment sequences, this operation is applied to the data set items (or fragments) in the sequence.

Does nothing if the attribute does not exist or the cardinality of the element is already lower than or equal to the given size.

Implementations§

Source§

impl AttributeAction

Source

pub fn is_constructive(&self) -> bool

Report whether this is considered a constructive action, operations of which create new elements if they do not exist yet.

The actions currently considered to be constructive are all actions of the families Set*, SetIfMissing, and Push*.

Trait Implementations§

Source§

impl Clone for AttributeAction

Source§

fn clone(&self) -> AttributeAction

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AttributeAction

Source§

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

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

impl PartialEq for AttributeAction

Source§

fn eq(&self, other: &AttributeAction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AttributeAction

Auto Trait Implementations§

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.