Skip to main content

Visibility

Struct Visibility 

Source
pub struct Visibility { /* private fields */ }
Expand description

Which of a page’s objects optional content hides, shaped like the page.

§Why a tree and not a set of ids

A page object has no id. The graph is Vec<PageObject> with a form’s children nested inside it, so the only thing that names an object is its position — and that is exactly what this mirrors: hidden[i] answers for objects[i], and a form’s children answer for that form’s own list. Walking the two together costs one index per object and needs no identity the page graph does not have.

An empty tree means nothing is hidden, which is what a document with no /OCProperties produces and what Visibility::shows_everything reports, so a renderer can skip the descent entirely.

Implementations§

Source§

impl Visibility

Source

pub fn all_visible() -> Self

Nothing hidden, for a document with no optional content.

Source

pub fn shows_everything(&self) -> bool

Whether this tree hides nothing anywhere beneath it.

A renderer can take this as licence to stop descending: an empty tree is the answer for a page with no optional content at all, and Self::visible already reports an absent entry as visible.

Source

pub fn visible(&self, index: usize) -> bool

Whether the object at index is drawn.

An index this tree does not cover is visible. That is not permissiveness for its own sake: it is what makes all_visible() an empty tree rather than a vector of true, and it means a caller whose object list has grown since the pre-pass ran draws the new objects rather than silently dropping them.

Source

pub fn children(&self, index: usize) -> Self

The tree describing the form at index’s own objects.

Trait Implementations§

Source§

impl Clone for Visibility

Source§

fn clone(&self) -> Visibility

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Visibility

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Visibility

Source§

fn default() -> Visibility

Returns the “default value” for a type. Read more
Source§

impl Eq for Visibility

Source§

impl PartialEq for Visibility

Source§

fn eq(&self, other: &Visibility) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Visibility

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.