Skip to main content

AttributeValue

Enum AttributeValue 

Source
pub enum AttributeValue {
    Number(f64),
    Text(String),
    Array(Vec<f64>),
    Name(String),
}
Expand description

A value in a structure attribute dictionary.

Variants§

§

Number(f64)

A numeric value.

§

Text(String)

A text (string) value.

§

Array(Vec<f64>)

An array of numbers.

§

Name(String)

A name value.

Implementations§

Source§

impl AttributeValue

Source

pub fn as_number(&self) -> Option<f64>

Returns the numeric value if this is a Number variant, else None.

Corresponds to upstream FPDF_StructElement_Attr_GetNumberValue.

Source

pub fn struct_element_attr_get_number_value(&self) -> Option<f64>

ADR-019 Tier 2 alias for as_number().

Corresponds to upstream FPDF_StructElement_Attr_GetNumberValue.

Source

pub fn get_number_value(&self) -> Option<f64>

👎Deprecated since 0.1.0:

use struct_element_attr_get_number_value() — matches upstream FPDF_StructElement_Attr_GetNumberValue

Deprecated short alias — use struct_element_attr_get_number_value() or as_number() instead.

Source

pub fn as_text(&self) -> Option<&str>

Returns the string value if this is a Text variant, else None.

Corresponds to upstream FPDF_StructElement_Attr_GetStringValue.

Source

pub fn struct_element_attr_get_string_value(&self) -> Option<&str>

ADR-019 Tier 2 alias for as_text().

Corresponds to upstream FPDF_StructElement_Attr_GetStringValue.

Source

pub fn get_string_value(&self) -> Option<&str>

👎Deprecated since 0.1.0:

use struct_element_attr_get_string_value() — matches upstream FPDF_StructElement_Attr_GetStringValue

Deprecated short alias — use struct_element_attr_get_string_value() or as_text() instead.

Source

pub fn as_name_str(&self) -> Option<&str>

Returns the name string if this is a Name variant, else None.

Corresponds to upstream FPDF_StructElement_Attr_GetType (distinguishes name from string).

Source

pub fn get_name_value(&self) -> Option<&str>

👎Deprecated:

use as_name_str() — no public FPDF_StructElement_Attr_GetNameValue API

Non-upstream alias — use as_name_str().

Source

pub fn as_array(&self) -> Option<&[f64]>

Returns the array of numbers if this is an Array variant, else None.

Corresponds to upstream FPDF_StructElement_Attr_CountChildren / FPDF_StructElement_Attr_GetChildAtIndex for array-valued attributes.

Source

pub fn get_array_value(&self) -> Option<&[f64]>

👎Deprecated:

use as_array() — no public FPDF_StructElement_Attr_GetArrayValue API

Non-upstream alias — use as_array().

Source

pub fn child_count(&self) -> i64

Returns the number of children (array elements) for an Array value, or -1.

Corresponds to upstream FPDF_StructElement_Attr_CountChildren.

Source

pub fn struct_element_attr_count_children(&self) -> i64

ADR-019 Tier 2 alias for child_count().

Corresponds to upstream FPDF_StructElement_Attr_CountChildren.

Source

pub fn count_children(&self) -> i64

👎Deprecated since 0.1.0:

use struct_element_attr_count_children() — matches upstream FPDF_StructElement_Attr_CountChildren

Deprecated short alias — use struct_element_attr_count_children() or child_count() instead.

Source

pub fn child_at_index(&self, index: usize) -> Option<f64>

Returns the child value at the given zero-based index for an Array value.

Returns None if the value is not an Array or the index is out of range. Corresponds to upstream FPDF_StructElement_Attr_GetChildAtIndex.

Source

pub fn struct_element_attr_get_child_at_index( &self, index: usize, ) -> Option<f64>

ADR-019 Tier 2 alias for child_at_index().

Corresponds to upstream FPDF_StructElement_Attr_GetChildAtIndex.

Source

pub fn get_child_at_index(&self, index: usize) -> Option<f64>

👎Deprecated since 0.1.0:

use struct_element_attr_get_child_at_index() — matches upstream FPDF_StructElement_Attr_GetChildAtIndex

Deprecated short alias — use struct_element_attr_get_child_at_index() or child_at_index() instead.

Source

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

Returns a string description of the type of this value.

  • "Number" for numeric values (PDF real/integer)
  • "String" for text string values
  • "Name" for PDF name values
  • "Array" for number arrays

Corresponds to upstream FPDF_StructElement_Attr_GetType.

Source

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

ADR-019 Tier 2 alias for type_name().

Corresponds to upstream FPDF_StructElement_Attr_GetType.

Source

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

👎Deprecated since 0.1.0:

use struct_element_attr_get_type() — matches upstream FPDF_StructElement_Attr_GetType

Deprecated short alias — use struct_element_attr_get_type() or type_name() instead.

Source

pub fn is_string_like(&self) -> bool

Returns true if this is a Name or Text variant (string-like types), false otherwise.

Corresponds to upstream FPDF_StructElement_Attr_GetBlobValue — blob values in upstream are raw string bytes; in rpdfium strings are always decoded to UTF-8.

Source

pub fn as_bool(&self) -> Option<bool>

Returns a boolean interpretation of this attribute value, or None if the value cannot be interpreted as a boolean.

  • Name("true") / Text("true")Some(true) (case-insensitive)
  • Name("false") / Text("false")Some(false) (case-insensitive)
  • Number(0.0)Some(false)
  • Number(non-zero)Some(true)
  • Array(_)None

Corresponds to upstream FPDF_StructElement_Attr_GetBooleanValue.

Source

pub fn struct_element_attr_get_boolean_value(&self) -> Option<bool>

ADR-019 Tier 2 alias for as_bool().

Corresponds to upstream FPDF_StructElement_Attr_GetBooleanValue.

Source

pub fn get_boolean_value(&self) -> Option<bool>

👎Deprecated since 0.1.0:

use struct_element_attr_get_boolean_value() — matches upstream FPDF_StructElement_Attr_GetBooleanValue

Deprecated short alias — use struct_element_attr_get_boolean_value() or as_bool() instead.

Source

pub fn as_blob(&self) -> Option<&[u8]>

Returns the raw bytes of the string value for blob-compatible types.

Returns Some(bytes) for Text and Name variants (as UTF-8 encoded bytes), None otherwise. Corresponds to upstream FPDF_StructElement_Attr_GetBlobValue.

Source

pub fn struct_element_attr_get_blob_value(&self) -> Option<&[u8]>

ADR-019 Tier 2 alias for as_blob().

Corresponds to upstream FPDF_StructElement_Attr_GetBlobValue.

Source

pub fn get_blob_value(&self) -> Option<&[u8]>

👎Deprecated since 0.1.0:

use struct_element_attr_get_blob_value() — matches upstream FPDF_StructElement_Attr_GetBlobValue

Deprecated short alias — use struct_element_attr_get_blob_value() or as_blob() instead.

Trait Implementations§

Source§

impl Clone for AttributeValue

Source§

fn clone(&self) -> AttributeValue

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 AttributeValue

Source§

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

Formats the value using the given formatter. 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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more