Skip to main content

Opcode

Enum Opcode 

Source
#[repr(u8)]
pub enum Opcode {
Show 18 variants OpenTag = 1, CloseTag = 2, VoidTag = 3, Text = 4, DynText = 5, DynAttr = 6, ShowIf = 7, ShowElse = 8, Switch = 9, List = 10, IslandStart = 11, IslandEnd = 12, TryStart = 13, Fallback = 14, Preload = 15, Comment = 16, ListItemKey = 17, Prop = 18,
}
Expand description

Bytecode opcodes for the FMIR instruction stream.

Variants§

§

OpenTag = 1

Open an element. str_idx(u32) + attr_count(u16) + [(key u32, val u32)]

§

CloseTag = 2

Close the named element. str_idx(u32)

§

VoidTag = 3

A void element, which takes no CLOSE_TAG. Same operands as OPEN_TAG.

§

Text = 4

Static text from the string table. str_idx(u32)

§

DynText = 5

Slot-bound text wrapped in <!--f:tN--> markers. slot_id(u16) + marker_id(u16)

§

DynAttr = 6

Slot-bound attribute on the tag currently being opened. attr_str_idx(u32) + slot_id(u16)

§

ShowIf = 7

Conditional region wrapped in <!--f:sN--> markers. slot_id(u16) + then_len(u32) + else_len(u32), then the two bodies separated by a Opcode::ShowElse byte.

§

ShowElse = 8

Separator byte between a SHOW_IF’s then- and else-bodies.

§

Switch = 9

First-match-wins multi-way branch on a slot’s text. slot_id(u16) + case_count(u16), then one (val_str_idx u32, body_len u32) header per case, then the bodies.

§

List = 10

Repeat a body once per element of an array slot, wrapped in <!--f:lN--> markers. slot_id(u16) + item_slot_id(u16) + body_len(u32)

§

IslandStart = 11

Begin an island region. island_id(u16)

§

IslandEnd = 12

End an island region. island_id(u16)

§

TryStart = 13

Begin a try block. fallback_len(u32)

§

Fallback = 14

Separator between a try block’s main and fallback bodies.

§

Preload = 15

Emit a <link rel="preload">. resource_type(u8) + url_str_idx(u32)

§

Comment = 16

An HTML comment. str_idx(u32)

§

ListItemKey = 17

Set data-forma-key on the next element opened in a LIST body. key_str_idx(u32)

LIMITATION: the operand is a static string-table index, so every item in a list gets the same key. Per-item keys would need a slot-bound operand, which is a v-bump to this opcode’s layout and a coordinated compiler change — not something the walker can work around.

§

Prop = 18

Extract a named property from an Object slot into a target slot. Format: src_slot_id(u16) + prop_str_idx(u32) + target_slot_id(u16)

Implementations§

Source§

impl Opcode

Source

pub fn from_byte(b: u8) -> Result<Self, IrError>

Convert a raw byte to an Opcode.

Trait Implementations§

Source§

impl Clone for Opcode

Source§

fn clone(&self) -> Self

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 Copy for Opcode

Source§

impl Debug for Opcode

Source§

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

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

impl Eq for Opcode

Source§

impl PartialEq for Opcode

Source§

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

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more