Skip to main content

PaintEnvelope

Struct PaintEnvelope 

Source
pub struct PaintEnvelope {
    pub engine: EngineId,
    pub viewport: DeviceIntSize,
    pub generation: u64,
    pub commands: Vec<PaintCmd>,
    pub fonts: Vec<FontResource>,
    pub images: Vec<ImageResource>,
}
Expand description

Wire shape for transporting a PaintList across IPC, fixture files, or any boundary where the producer’s concrete PaintList impl can’t be carried by name. PM-3 doc proposed enum { Genet(GenetPaintList), Nematic(...), Scrying(...) }; implementation went with a flat struct + EngineId discriminant because none of the concrete impls carry engine-specific extra fields beyond what the trait already exposes, and the enum shape would force paint-api to depend on every engine crate.

Same closed-set property as the doc’s enum (EngineId is closed), without the dep inversion. If a future engine grows truly engine-specific transport fields, switch to the enum then.

Fields§

§engine: EngineId

Which engine produced this. Receivers route on this discriminant.

§viewport: DeviceIntSize

Viewport the commands were computed against.

§generation: u64

Producer-rolled semantic-equivalence epoch. Same value asserts identical paint output across resends.

§commands: Vec<PaintCmd>

Paint command stream in paint order.

§fonts: Vec<FontResource>

Font resources referenced by DrawText commands. See FontResource.

§images: Vec<ImageResource>

Image resources referenced by DrawImage / DrawRepeatingImage commands. See ImageResource.

Implementations§

Source§

impl PaintEnvelope

Source

pub fn from_list<L: PaintList>(list: &L) -> Self

Package any PaintList impl into the wire form. Clones the command + font slices — the envelope owns its payload once constructed. Callers that need zero-copy transport can build the envelope manually with Vec::from/Cow patterns as usage shapes emerge.

Trait Implementations§

Source§

impl Clone for PaintEnvelope

Source§

fn clone(&self) -> PaintEnvelope

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 PaintEnvelope

Source§

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

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

impl<'de> Deserialize<'de> for PaintEnvelope

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PaintList for PaintEnvelope

Source§

fn engine_id(&self) -> EngineId

Which engine produced this list. Receivers downstream of the transport envelope match on the envelope variant directly; this accessor exists for diagnostics and for in-process callers that hold a concrete &L: PaintList. The trait is not dyn-compatible (the supertrait bounds aren’t object-safe) — engine-agnostic code dispatches on the envelope, not on a trait object.
Source§

fn viewport(&self) -> DeviceIntSize

Final viewport this paint output is computed against. Renderers use this for culling and for setting the render-target size.
Source§

fn generation_id(&self) -> u64

Producer-rolled semantic-equivalence epoch. Same (source_id, generation_id) asserts identical paint output and resource references; the renderer may use this to skip relowering (PaintList → Scene). Not a tile-cache invalidation key — tile-cache correctness still derives from SceneOp content hashing post-lowering.
Source§

fn commands(&self) -> &[PaintCmd]

Paint commands in paint order. Push-order is paint-order. The return type is a slice rather than an iterator on the assumption that paint output is built-then-shipped, not streamed; revisit if a streaming consumer surfaces.
Source§

fn fonts(&self) -> &[FontResource]

Font resources referenced by DrawText commands in this list. Each FontResource carries the font bytes + the FontInstanceKey that TextRunItem::font_instance points at; the renderer registers these into its font palette and resolves each text run’s key to a concrete font. Default is empty — only lists that emit text populate it.
Source§

fn images(&self) -> &[ImageResource]

Image resources referenced by DrawImage / DrawRepeatingImage commands. Each ImageResource carries decoded RGBA8 pixels + the ImageKey that ImageItem::image_key points at; the renderer registers these into its image atlas and resolves each image item’s key to a concrete texture. Default is empty.
Source§

impl Serialize for PaintEnvelope

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.