pub struct AnnotObjectCtxMut<'doc> { /* private fields */ }Expand description
Mutable context for accessing AP-stream objects on a single annotation.
Obtained via EditDocument::annot_objects_mut().
§Example
let mut ctx = doc.annot_objects_mut(annot_id);
ctx.append_object(obj).unwrap();
ctx.remove_object(0).unwrap();Implementations§
Source§impl<'doc> AnnotObjectCtxMut<'doc>
impl<'doc> AnnotObjectCtxMut<'doc>
Sourcepub fn get_object(&self, index: usize) -> Option<&PageObject>
pub fn get_object(&self, index: usize) -> Option<&PageObject>
Returns a reference to the AP-stream object at index.
ADR-019 T2 alias for FPDFAnnot_GetObject.
Sourcepub fn get_object_count(&self) -> usize
pub fn get_object_count(&self) -> usize
Returns the number of AP-stream objects for this annotation.
ADR-019 T2 alias for FPDFAnnot_GetObjectCount.
Sourcepub fn remove_object(&mut self, index: usize) -> Result<(), EditError>
pub fn remove_object(&mut self, index: usize) -> Result<(), EditError>
Remove the AP-stream object at index from this annotation.
ADR-019 T2 alias for FPDFAnnot_RemoveObject. Namespaced here to
avoid collision with the FPDFPage_RemoveObject alias on
EditDocument.
See also PageObjectCtxMut::remove_object() for the page side.
Sourcepub fn append_object(&mut self, object: PageObject) -> Result<(), EditError>
pub fn append_object(&mut self, object: PageObject) -> Result<(), EditError>
Append a page object to this annotation’s AP-stream object list.
ADR-019 T2 alias for FPDFAnnot_AppendObject.
Sourcepub fn get_object_mut(&mut self, index: usize) -> Option<&mut PageObject>
pub fn get_object_mut(&mut self, index: usize) -> Option<&mut PageObject>
Returns a mutable reference to the AP-stream object at index.
Returns None if index is out of bounds.
There is no upstream FPDFAnnot_GetObjectMut; mutable access is
Rust-specific. This is the canonical way to modify an annotation’s
AP-stream objects in-place.