pub enum PdfObject {
Null,
Bool(bool),
Int(i64),
Real(f64),
Name(String),
Str(Vec<u8>),
Array(Vec<Obj>),
Dict(Vec<(String, Obj)>),
Ref(u32),
Seq(Vec<Obj>),
Raw(Vec<u8>),
}Expand description
A PDF object, or an operator or verbatim content in a content stream
(what matplotlib’s pdfRepr writes: numbers, names, strings, arrays,
dictionaries, references, null, Ops and Verbatim content).
use pltrs_render::PdfObject;
let page = PdfObject::Dict(vec![
("Type".to_owned(), PdfObject::name("Page")),
("Parent".to_owned(), PdfObject::Ref(2)),
("Rotate".to_owned(), PdfObject::Null),
]);
assert_eq!(page.repr()?, b"<< /Type /Page /Parent 2 0 R /Rotate null >>");Variants§
Null
null.
Bool(bool)
true / false.
Int(i64)
An integer.
Real(f64)
A real number (written with up to ten decimals).
Name(String)
A name (/Name).
Str(Vec<u8>)
A literal string.
Array(Vec<Obj>)
An array.
Dict(Vec<(String, Obj)>)
A dictionary with keys in insertion order.
Ref(u32)
An indirect reference (12 0 R).
Seq(Vec<Obj>)
Objects separated by spaces without brackets (how a Bbox is
written: x y width height).
Raw(Vec<u8>)
Bytes written as they are: operators and path data.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Obj
Auto Trait Implementations§
impl Forget for Obj
impl Freeze for Obj
impl Move for Obj
impl RefUnwindSafe for Obj
impl Send for Obj
impl Sync for Obj
impl Unpin for Obj
impl UnsafeUnpin for Obj
impl UnwindSafe for Obj
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