Skip to main content

StreamBounds

Struct StreamBounds 

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

Where each /Contents element’s operators begin, within one flat operator list.

A page’s content is the concatenation of its /Contents streams, and the interpreter reads it as one run — a q in one element is closed by the Q in the next, which is legal and common. The editor still needs to know which element each object came from, so the boundaries travel alongside the operators rather than being recovered from them.

starts[i] is the index of the first operator belonging to element i. An empty record means a single unsplit stream: everything is element 0.

Implementations§

Source§

impl StreamBounds

Source

pub fn from_counts(counts: impl IntoIterator<Item = usize>) -> Self

The boundaries for content split into elements of the given operator counts.

Source

pub fn from_joined( bytes: &[u8], total_ops: usize, ends: &[usize], limits: &Limits, ) -> Self

The boundaries for content joined from elements ending at the given byte offsets.

ends[i] is one past the last byte of element i, counting the separator a join inserts. A single element — or none — yields the default, where everything is element 0.

Source

pub fn stream_of(&self, op_index: usize) -> usize

Which element the operator at op_index belongs to.

The last element whose start is at or before the operator — so an operator past every recorded start belongs to the final element, and a record with no starts at all answers 0.

Source

pub fn len(&self) -> usize

How many elements the content was split into.

Source

pub fn is_empty(&self) -> bool

Whether the content was never split.

Trait Implementations§

Source§

impl Clone for StreamBounds

Source§

fn clone(&self) -> StreamBounds

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 StreamBounds

Source§

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

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

impl Default for StreamBounds

Source§

fn default() -> StreamBounds

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

impl Eq for StreamBounds

Source§

impl PartialEq for StreamBounds

Source§

fn eq(&self, other: &StreamBounds) -> 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 StreamBounds

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.