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
impl AttributeValue
Sourcepub fn as_number(&self) -> Option<f64>
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.
Sourcepub fn struct_element_attr_get_number_value(&self) -> Option<f64>
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.
Sourcepub 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
pub fn get_number_value(&self) -> Option<f64>
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.
Sourcepub fn as_text(&self) -> Option<&str>
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.
Sourcepub fn struct_element_attr_get_string_value(&self) -> Option<&str>
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.
Sourcepub 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
pub fn get_string_value(&self) -> Option<&str>
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.
Sourcepub fn as_name_str(&self) -> Option<&str>
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).
Sourcepub fn get_name_value(&self) -> Option<&str>
👎Deprecated: use as_name_str() — no public FPDF_StructElement_Attr_GetNameValue API
pub fn get_name_value(&self) -> Option<&str>
use as_name_str() — no public FPDF_StructElement_Attr_GetNameValue API
Non-upstream alias — use as_name_str().
Sourcepub fn as_array(&self) -> Option<&[f64]>
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.
Sourcepub fn get_array_value(&self) -> Option<&[f64]>
👎Deprecated: use as_array() — no public FPDF_StructElement_Attr_GetArrayValue API
pub fn get_array_value(&self) -> Option<&[f64]>
use as_array() — no public FPDF_StructElement_Attr_GetArrayValue API
Non-upstream alias — use as_array().
Sourcepub fn child_count(&self) -> i64
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.
Sourcepub fn struct_element_attr_count_children(&self) -> i64
pub fn struct_element_attr_count_children(&self) -> i64
ADR-019 Tier 2 alias for child_count().
Corresponds to upstream FPDF_StructElement_Attr_CountChildren.
Sourcepub fn count_children(&self) -> i64
👎Deprecated since 0.1.0: use struct_element_attr_count_children() — matches upstream FPDF_StructElement_Attr_CountChildren
pub fn count_children(&self) -> i64
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.
Sourcepub fn child_at_index(&self, index: usize) -> Option<f64>
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.
Sourcepub fn struct_element_attr_get_child_at_index(
&self,
index: usize,
) -> Option<f64>
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.
Sourcepub 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
pub fn get_child_at_index(&self, index: usize) -> Option<f64>
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.
Sourcepub fn type_name(&self) -> &'static str
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.
Sourcepub fn struct_element_attr_get_type(&self) -> &'static str
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.
Sourcepub fn get_type(&self) -> &'static str
👎Deprecated since 0.1.0: use struct_element_attr_get_type() — matches upstream FPDF_StructElement_Attr_GetType
pub fn get_type(&self) -> &'static str
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.
Sourcepub fn is_string_like(&self) -> bool
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.
Sourcepub fn as_bool(&self) -> Option<bool>
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.
Sourcepub fn struct_element_attr_get_boolean_value(&self) -> Option<bool>
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.
Sourcepub 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
pub fn get_boolean_value(&self) -> Option<bool>
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.
Sourcepub fn as_blob(&self) -> Option<&[u8]>
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.
Sourcepub fn struct_element_attr_get_blob_value(&self) -> Option<&[u8]>
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.
Sourcepub 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
pub fn get_blob_value(&self) -> Option<&[u8]>
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
impl Clone for AttributeValue
Source§fn clone(&self) -> AttributeValue
fn clone(&self) -> AttributeValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more