Struct dicom_core::value::person_name::PersonName
source · pub struct PersonName<'a> { /* private fields */ }
Expand description
A DICOM Person Name (PN value representation).
Values of this type keep family name, given name, middle name, prefix and suffix as borrowed values. All name components are optional.
§Example
A value of type PersonName
can be obtained
either by parsing a DICOM formatted string via from_text
or by using the builder API.
let dr_seuss: PersonName = PersonName::from_text("Geisel^Theodor^Seuss^Dr.");
assert_eq!(&dr_seuss.to_string(), "Dr. Theodor Seuss Geisel");
assert_eq!(dr_seuss.prefix(), Some("Dr."));
assert_eq!(dr_seuss.given(), Some("Theodor"));
Implementations§
source§impl<'a> PersonName<'a>
impl<'a> PersonName<'a>
sourcepub fn to_dicom_string(&self) -> String
pub fn to_dicom_string(&self) -> String
Convert the person name into a DICOM formatted string.
Name components are interspersed with a '^'
separator.
Leading null components produce a separator,
while trailing components do not.
sourcepub fn from_text(slice: &'a str) -> PersonName<'a>
pub fn from_text(slice: &'a str) -> PersonName<'a>
Obtains a person name by interpreting slice
as a DICOM formatted string.
The DICOM string representation is split by the '^'
separator
into its respective components.
When passing a text value to this function,
ensure that it contains a single DICOM formatted name.
sourcepub fn builder() -> PersonNameBuilder<'a>
pub fn builder() -> PersonNameBuilder<'a>
Retrieve a builder for a person name.
See PersonNameBuilder
for more information.
Trait Implementations§
source§impl<'a> Clone for PersonName<'a>
impl<'a> Clone for PersonName<'a>
source§fn clone(&self) -> PersonName<'a>
fn clone(&self) -> PersonName<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for PersonName<'a>
impl<'a> Debug for PersonName<'a>
source§impl Display for PersonName<'_>
impl Display for PersonName<'_>
source§impl<'a> From<&mut PersonNameBuilder<'a>> for PersonName<'a>
impl<'a> From<&mut PersonNameBuilder<'a>> for PersonName<'a>
source§fn from(builder: &mut PersonNameBuilder<'a>) -> Self
fn from(builder: &mut PersonNameBuilder<'a>) -> Self
source§impl<'a> From<PersonName<'a>> for PrimitiveValue
impl<'a> From<PersonName<'a>> for PrimitiveValue
source§fn from(p: PersonName<'_>) -> Self
fn from(p: PersonName<'_>) -> Self
source§impl<'a> From<PersonNameBuilder<'a>> for PersonName<'a>
impl<'a> From<PersonNameBuilder<'a>> for PersonName<'a>
source§fn from(builder: PersonNameBuilder<'a>) -> Self
fn from(builder: PersonNameBuilder<'a>) -> Self
source§impl<'a> Hash for PersonName<'a>
impl<'a> Hash for PersonName<'a>
source§impl<'a> PartialEq for PersonName<'a>
impl<'a> PartialEq for PersonName<'a>
source§fn eq(&self, other: &PersonName<'a>) -> bool
fn eq(&self, other: &PersonName<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.impl<'a> Copy for PersonName<'a>
impl<'a> Eq for PersonName<'a>
impl<'a> StructuralPartialEq for PersonName<'a>
Auto Trait Implementations§
impl<'a> Freeze for PersonName<'a>
impl<'a> RefUnwindSafe for PersonName<'a>
impl<'a> Send for PersonName<'a>
impl<'a> Sync for PersonName<'a>
impl<'a> Unpin for PersonName<'a>
impl<'a> UnwindSafe for PersonName<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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