Skip to main content

GenericRecord

Struct GenericRecord 

Source
pub struct GenericRecord { /* private fields */ }
Expand description

A record with dynamic field access for parameter format.

Preserves original field order and tracks modifications for non-destructive round-trip editing.

Implementations§

Source§

impl GenericRecord

Source

pub fn from_params(params: &ParameterCollection) -> Self

Creates a GenericRecord from a ParameterCollection.

Source

pub fn new(record_id: i32) -> Self

Creates an empty GenericRecord with a given record ID.

Source

pub fn record_id(&self) -> Option<i32>

Returns the record ID (RECORD parameter).

Source

pub fn type_name(&self) -> &'static str

Returns a human-readable type name based on record ID.

Source

pub fn contains(&self, key: &str) -> bool

Returns true if the field exists.

Source

pub fn get(&self, key: &str) -> Option<&Value>

Gets a field value.

Source

pub fn get_or<'a>(&'a self, key: &str, default: &'a Value) -> &'a Value

Gets a field value with a default.

Source

pub fn get_bool(&self, key: &str) -> Option<bool>

Gets a field as a boolean.

Source

pub fn get_int(&self, key: &str) -> Option<i64>

Gets a field as an integer.

Source

pub fn get_float(&self, key: &str) -> Option<f64>

Gets a field as a float.

Source

pub fn get_str(&self, key: &str) -> Option<&str>

Gets a field as a string.

Source

pub fn get_coord(&self, key: &str) -> Option<Coord>

Gets a field as a coordinate.

Source

pub fn get_color(&self, key: &str) -> Option<Color>

Gets a field as a color.

Source

pub fn get_layer(&self, key: &str) -> Option<Layer>

Gets a field as a layer.

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, &Value)>

Iterates over all fields in original order.

Source

pub fn keys(&self) -> impl Iterator<Item = &str>

Returns field keys in original order.

Source

pub fn values(&self) -> impl Iterator<Item = &Value>

Returns field values in original order.

Source

pub fn len(&self) -> usize

Returns the number of fields.

Source

pub fn is_empty(&self) -> bool

Returns true if there are no fields.

Source

pub fn set(&mut self, key: &str, value: impl Into<Value>)

Sets a field value, preserving position if it exists.

Source

pub fn remove(&mut self, key: &str) -> Option<Value>

Removes a field and returns its value.

Source

pub fn is_modified(&self) -> bool

Returns true if any fields were modified.

Source

pub fn modified_fields(&self) -> Vec<&str>

Returns the names of modified fields.

Source

pub fn reset(&mut self)

Resets all modifications, restoring original values.

Source

pub fn to_params(&self) -> ParameterCollection

Converts back to a ParameterCollection.

Source

pub fn to_params_string(&self) -> String

Converts to a parameter string.

Source

pub fn raw_data(&self) -> &str

Returns the raw original data.

Source

pub fn owner_index(&self) -> i32

Gets the owner index (OWNERINDEX parameter).

Source

pub fn set_owner_index(&mut self, index: i32)

Sets the owner index.

Trait Implementations§

Source§

impl Clone for GenericRecord

Source§

fn clone(&self) -> GenericRecord

Returns a duplicate 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 GenericRecord

Source§

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

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

impl Default for GenericRecord

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Index<&str> for GenericRecord

Source§

type Output = Value

The returned type after indexing.
Source§

fn index(&self, key: &str) -> &Value

Performs the indexing (container[index]) operation. Read more

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> 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<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool