pub struct PdfArray(pub Vec<PdfObject>);
Expand description
PDF Array object - Ordered collection of PDF objects.
Arrays can contain any PDF object type, including other arrays and dictionaries.
They are written in PDF syntax as [item1 item2 ... itemN]
.
§Common Uses
- Rectangle specifications:
[llx lly urx ury]
- Color values:
[r g b]
- Matrix transformations:
[a b c d e f]
- Resource lists
§Example
use oxidize_pdf::parser::objects::{PdfArray, PdfObject};
// Create a MediaBox array [0 0 612 792]
let mut media_box = PdfArray::new();
media_box.push(PdfObject::Integer(0));
media_box.push(PdfObject::Integer(0));
media_box.push(PdfObject::Integer(612));
media_box.push(PdfObject::Integer(792));
assert_eq!(media_box.len(), 4);
Tuple Fields§
§0: Vec<PdfObject>
Implementations§
Source§impl PdfArray
impl PdfArray
Sourcepub fn get(&self, index: usize) -> Option<&PdfObject>
pub fn get(&self, index: usize) -> Option<&PdfObject>
Get element at index.
§Arguments
index
- Zero-based index
§Returns
Reference to the element if index is valid, None otherwise.
§Example
use oxidize_pdf::parser::objects::{PdfArray, PdfObject};
let mut array = PdfArray::new();
array.push(PdfObject::Integer(10));
array.push(PdfObject::Integer(20));
assert_eq!(array.get(0).and_then(|o| o.as_integer()), Some(10));
assert_eq!(array.get(1).and_then(|o| o.as_integer()), Some(20));
assert!(array.get(2).is_none());
Trait Implementations§
impl StructuralPartialEq for PdfArray
Auto Trait Implementations§
impl Freeze for PdfArray
impl RefUnwindSafe for PdfArray
impl Send for PdfArray
impl Sync for PdfArray
impl Unpin for PdfArray
impl UnwindSafe for PdfArray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more