[][src]Struct zathura_plugin::DocumentRef

pub struct DocumentRef<'a> { /* fields omitted */ }

A mutable reference to a Zathura document.

Methods

impl<'_> DocumentRef<'_>[src]

pub unsafe fn from_raw(ptr: *mut zathura_document_t) -> Self[src]

Creates a document reference from a raw pointer.

Safety

This method requires that ptr points to a valid Zathura document. The returned DocumentRef also has a dangling lifetime, which must be constrained by the caller so that it doesn't outlive the document.

Only a single DocumentRef may be created for the same document, since it is effectively a mutable reference. A DocumentRef may not coexist with PageRefs to pages in the document either, since they can be mutably accessed via page.

pub fn path_raw(&self) -> Option<&CStr>[src]

Returns the file path as a raw C string.

If the document was loaded from a URI, this might return None or a temporary file path.

pub fn path(&self) -> Option<Result<&str, Utf8Error>>[src]

Returns the file path from which this document was or will be loaded.

If the document was loaded from a URI and not a local file path, this might return None or a temporary file path. Returns a Utf8Error when the raw path does not contain valid UTF-8.

pub fn uri_raw(&self) -> Option<&CStr>[src]

Returns the URI this document was loaded from.

If the document was loaded from a local file path instead of a URI, this will return None.

pub fn uri(&self) -> Option<Result<&str, Utf8Error>>[src]

Returns the URI from which this document was or will be loaded.

Returns None if the document was loaded from a local file path and not a URI. Returns a Utf8Error when the raw URI does not contain valid UTF-8.

pub fn basename_raw(&self) -> &CStr[src]

pub fn basename(&self) -> Result<&str, Utf8Error>[src]

pub fn zoom(&self) -> f64[src]

pub fn scale(&self) -> f64[src]

pub fn rotation(&self) -> u32[src]

Returns the viewport rotation in degrees.

pub fn viewport_ppi(&self) -> f64[src]

pub fn scaling_factors(&self) -> (f64, f64)[src]

pub fn cell_size(&self) -> (u32, u32)[src]

pub fn page_count(&self) -> u32[src]

Returns the number of pages in this document.

pub fn page<'a>(&'a mut self, index: usize) -> Option<PageRef<'a>>[src]

Obtains a mutable reference to the page at index.

Returns None when index is larger than or equal to the number of pages in this document.

pub fn current_page_index(&self) -> u32[src]

pub unsafe fn set_page_count(&mut self, count: u32)[src]

Unsafely sets the page count in the document to another value.

This will not allocate any pages.

Safety

This enables UB via dangling pointer deref through methods like page. It should only be used when the situation will be corrected immediately (eg. by allocating the right number of pages).

pub fn plugin_data(&self) -> *mut ()[src]

pub unsafe fn set_plugin_data(&mut self, data: *mut ())[src]

Sets the custom plugin data pointer to data.

Safety

This method is unsafe and should not be used by plugins. Instead, the ZathuraPlugin trait already provides an associated DocumentData type, which can be used instead.

This library will assume that the plugin data is a *mut Plugin::DocumentData obtained using Box::into_raw, and will free the data automatically.

Trait Implementations

impl<'a> Debug for DocumentRef<'a>[src]

Auto Trait Implementations

impl<'a> !Send for DocumentRef<'a>

impl<'a> !Sync for DocumentRef<'a>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]