Skip to main content

ElementData

Struct ElementData 

Source
pub struct ElementData {
Show 15 fields pub path: String, pub element_type: ElementType, pub document_type: DocumentType, pub date: Date, pub number_value: String, pub number_display: String, pub verbose_name: String, pub heading: Option<String>, pub chapeau: Option<String>, pub proviso: Option<String>, pub content: Option<String>, pub continuation: Option<String>, pub uslm_id: Option<String>, pub uslm_uuid: Option<String>, pub source_credits: Vec<SourceCredit>,
}
Expand description

Metadata and content for a single element in a USLM document

This struct contains all the information about a legislative element, including its position in the document hierarchy, identification paths, display information, and text content.

§Path Systems

Each element has two types of paths:

  1. Structural Path (path): Includes all hierarchy elements, even non-USLM ones like Level. Example: uscode/title_26/subtitle_k/chapter_100/section_9834/level_1

  2. USLM ID (uslm_id): Official USLM identifier following standard format. Only present for elements in the USLM scheme. Example: /us/usc/t26/s9834/a/1

Combining the structural path with the date provides a unique identifier for any element across all versions of the document.

Fields§

§path: String

The full structural path in the document for the element

This includes all structural elements like Level that may not be part of the USLM identifier. Note that combining this with the date field gives a unique identifier for the document For example:

uscode/title_26/subtitle_k/chapter_100/subchapter_c/section_9834/level_1

§element_type: ElementType

The type of this element in the legislative hierarchy

§document_type: DocumentType

The type of document this element belongs to

§date: Date

The date this version of the document was published

§number_value: String

The raw number or identifier value (e.g., “174”, “a”, “1”)

§number_display: String

The formatted display version of the number (may include prefixes/suffixes)

§verbose_name: String

A human-readable name for this element (e.g., “Section 174”)

§heading: Option<String>

The heading or title text of the element

§chapeau: Option<String>

The words at the start of the element that appear before any enumerated items

§proviso: Option<String>

A clause imposing a qualification, condition, or restriction

§content: Option<String>

The main text content of the element

§continuation: Option<String>

Text content that appears after all child elements

§uslm_id: Option<String>

The USLM-standard identifier path for this element

This follows the official USLM path format and excludes structural-only elements. For example: /us/usc/t26/s1/a/1 or /us/pl/119-21/s1/a

This is computed according to USLM standards for elements that are part of the USLM identifier scheme. If the XML provides an identifier attribute, it is validated to match this generated path.

Structural-only elements like Level will have None here, as they are not part of the USLM identifier scheme.

§uslm_uuid: Option<String>

The USLM id attribute for an element

Takes the form of a UUID, not guaranteed to exist

§source_credits: Vec<SourceCredit>

Source credits and references for this element

Implementations§

Source§

impl ElementData

Source

pub fn get_text_content(&self, field: TextContentField) -> Option<String>

Retrieve the text content for a specific field

§Arguments
  • field - The text content field to retrieve
§Returns

Returns Some(String) if the field has content, or None if the field is empty for this element.

Trait Implementations§

Source§

impl Clone for ElementData

Source§

fn clone(&self) -> ElementData

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 Debug for ElementData

Source§

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

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

impl<'de> Deserialize<'de> for ElementData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for ElementData

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ElementData

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Serialize for ElementData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for ElementData

Source§

impl StructuralPartialEq for ElementData

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, 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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,