pub struct AltSpec {
pub m: Option<String>,
/* private fields */
}Expand description
One emitted alternate: the engine’s alt fields in the order they were
written, plus the compiler-internal mark m, which never reaches the
wire.
The fields are kept as an insertion-ordered map with JavaScript
assignment semantics (set on an existing key updates it in place, on
a new key appends it), because the canonical compiler builds each
alternate as an object literal and the serialised text is byte-stable
only when this port writes the keys in the same order at every site.
Fields§
§m: Option<String>Implementations§
Source§impl AltSpec
impl AltSpec
pub fn new() -> AltSpec
Sourcepub fn set(&mut self, key: &str, value: impl Into<Value>) -> &mut AltSpec
pub fn set(&mut self, key: &str, value: impl Into<Value>) -> &mut AltSpec
Assign a field: an existing key keeps its position, a new one is appended.
pub fn remove(&mut self, key: &str) -> Option<Value>
pub fn get(&self, key: &str) -> Option<&Value>
pub fn contains(&self, key: &str) -> bool
Sourcepub fn assign_from(&mut self, other: &AltSpec) -> &mut AltSpec
pub fn assign_from(&mut self, other: &AltSpec) -> &mut AltSpec
Copy every field of other onto this alternate, in other’s
order: the JavaScript spread { ...this, ...other }.
Sourcepub fn actions(&self) -> Vec<String>
pub fn actions(&self) -> Vec<String>
The action refs, as a list: a scalar a is one, an array is each.
Sourcepub fn set_actions(&mut self, actions: &[&str])
pub fn set_actions(&mut self, actions: &[&str])
Assign the action refs: none removes a, one is a scalar on the
wire, several are an array.
Sourcepub fn append_action(&mut self, added: &str)
pub fn append_action(&mut self, added: &str)
Append an action ref, producing the engine’s array-a form so the
alt’s own action runs first.