Skip to content

Commit

Permalink
[object] Tweak documentation of new methods
Browse files Browse the repository at this point in the history
- tweak phrasing and expand error conditions
- adjust doctests to be more idiomatic
  • Loading branch information
Enet4 committed Apr 25, 2024
1 parent 3b5eb36 commit e13733c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions object/src/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,21 +717,27 @@ where

/// Get a private element from the dataset using the group number, creator and element number.
///
/// For more info, see the [DICOM standard section on private elements](https://dicom.nema.org/medical/dicom/2024a/output/chtml/part05/sect_7.8.html)
/// An error is raised when the group number is not odd,
/// the private creator is not found in the group,
/// or the private element is not found.
///
/// For more info, see the [DICOM standard section on private elements][1].
///
/// [1]: https://dicom.nema.org/medical/dicom/2024a/output/chtml/part05/sect_7.8.html
///
/// ## Example
///
/// ```
/// # use dicom_core::{VR, PrimitiveValue, Tag, DataElement};
/// # use dicom_object::{InMemDicomObject, PrivateElementError};
/// # use std::error::Error;
/// let mut ds = InMemDicomObject::from_element_iter(vec![
/// let mut ds = InMemDicomObject::from_element_iter([
/// DataElement::new(
/// Tag(0x0009, 0x0010),
/// VR::LO,
/// PrimitiveValue::from("CREATOR 1"),
/// ),
/// DataElement::new(Tag(0x0009, 0x01001), VR::DS, PrimitiveValue::from("1.0")),
/// DataElement::new(Tag(0x0009, 0x01001), VR::DS, "1.0"),
/// ]);
/// assert_eq!(
/// ds.private_element(0x0009, "CREATOR 1", 0x01)?
Expand Down Expand Up @@ -791,8 +797,11 @@ where
/// group. If the creator already exists, the element will be added to the block
/// already reserved for that creator. If it does not exist, then a new block
/// will be reserved for the creator in the specified group.
/// An error is returned if there is no space left in the group.
///
/// For more info, see the [DICOM standard section on private elements](https://dicom.nema.org/medical/dicom/2024a/output/chtml/part05/sect_7.8.html)
/// For more info, see the [DICOM standard section on private elements][1].
///
/// [1]: https://dicom.nema.org/medical/dicom/2024a/output/chtml/part05/sect_7.8.html
///
/// ## Example
/// ```
Expand All @@ -805,7 +814,7 @@ where
/// "CREATOR 1",
/// 0x02,
/// VR::DS,
/// PrimitiveValue::Str("1.0".to_string()),
/// PrimitiveValue::from("1.0"),
/// )?;
/// assert_eq!(
/// ds.private_element(0x0009, "CREATOR 1", 0x02)?
Expand Down

0 comments on commit e13733c

Please sign in to comment.