pub struct SpecificCharacterSet(/* private fields */);Expand description
A descriptor for a specific character set, taking part in text encoding and decoding as per PS3.5 ch 6 6.1.
§Example
Use from_code
or one of the associated constants to create a character set.
From there, use the TextCodec trait to encode and decode text.
use dcmnorm_encoding::text::{SpecificCharacterSet, TextCodec};
let character_set = SpecificCharacterSet::from_code("ISO_IR 100").unwrap();
assert_eq!(character_set, SpecificCharacterSet::ISO_IR_100);Implementations§
Source§impl SpecificCharacterSet
impl SpecificCharacterSet
Sourcepub const ISO_IR_6: SpecificCharacterSet
pub const ISO_IR_6: SpecificCharacterSet
ISO IR 6: The default character set, as defined by the DICOM standard.
pub const ISO_IR_100: SpecificCharacterSet
Sourcepub const ISO_IR_192: SpecificCharacterSet
pub const ISO_IR_192: SpecificCharacterSet
ISO IR 192: UTF-8 encoding
Sourcepub fn from_code(code: &str) -> Option<Self>
pub fn from_code(code: &str) -> Option<Self>
Obtain the specific character set identified by the given code string.
Supported code strings include the possible values in the respective DICOM element (0008, 0005).
§Example
use dcmnorm_encoding::text::{SpecificCharacterSet, TextCodec};
let character_set = SpecificCharacterSet::from_code("ISO_IR 100").unwrap();
assert_eq!(character_set.name(), "ISO_IR 100");Sourcepub fn from_codes<S: AsRef<str>>(codes: &[S]) -> Option<Self>
pub fn from_codes<S: AsRef<str>>(codes: &[S]) -> Option<Self>
Obtain the specific character set for all the values of a Specific Character Set
(0008,0005) element. A single value is the same as from_code; more
than one (\ISO 2022 IR 87, ISO 2022 IR 6\ISO 2022 IR 149) selects ISO 2022 code
extension, where text switches between the declared character sets with escape
sequences (PS3.5 6.1.2.5). An empty first value is the default repertoire.
Unsupported values are left out; None when no value is supported.
use dcmnorm_encoding::text::{SpecificCharacterSet, TextCodec};
let charset = SpecificCharacterSet::from_codes(&["", "ISO 2022 IR 87"]).unwrap();
assert_eq!(charset.decode(b"\x1b$B;n83\x1b(B").unwrap(), "試験");Trait Implementations§
Source§impl Clone for SpecificCharacterSet
impl Clone for SpecificCharacterSet
Source§impl Debug for SpecificCharacterSet
impl Debug for SpecificCharacterSet
Source§impl Default for SpecificCharacterSet
impl Default for SpecificCharacterSet
Source§impl PartialEq for SpecificCharacterSet
impl PartialEq for SpecificCharacterSet
impl StructuralPartialEq for SpecificCharacterSet
Source§impl TextCodec for SpecificCharacterSet
impl TextCodec for SpecificCharacterSet
Source§fn name(&self) -> Cow<'static, str>
fn name(&self) -> Cow<'static, str>
Auto Trait Implementations§
impl Forget for SpecificCharacterSet
impl Freeze for SpecificCharacterSet
impl Move for SpecificCharacterSet
impl RefUnwindSafe for SpecificCharacterSet
impl Send for SpecificCharacterSet
impl Sync for SpecificCharacterSet
impl Unpin for SpecificCharacterSet
impl UnsafeUnpin for SpecificCharacterSet
impl UnwindSafe for SpecificCharacterSet
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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