pub struct GrammarContributions { /* private fields */ }Expand description
The per-plugin accumulator the grammar::Host impl records into during
register-grammar (lib.rs). Held in PluginState; drained by the host
after the registration export returns (PH7.7c). The record_* methods are
the sync host-func bodies (they only push — they cannot trap), factored here
(the host_services::walk_within_grant precedent) so the recording logic is
unit-testable without a PluginState / guest.
Implementations§
Source§impl GrammarContributions
impl GrammarContributions
Sourcepub fn record_motion(
&mut self,
name: String,
doc: String,
spec: WitMotionSpec,
callback: u32,
)
pub fn record_motion( &mut self, name: String, doc: String, spec: WitMotionSpec, callback: u32, )
Record a motion contribution (the grammar.register-motion body).
Sourcepub fn record_operator(
&mut self,
name: String,
doc: String,
spec: WitOperatorSpec,
callback: u32,
)
pub fn record_operator( &mut self, name: String, doc: String, spec: WitOperatorSpec, callback: u32, )
Record an operator contribution (grammar.register-operator).
Sourcepub fn record_text_object(
&mut self,
name: String,
doc: String,
spec: WitTextObjectSpec,
callback: u32,
)
pub fn record_text_object( &mut self, name: String, doc: String, spec: WitTextObjectSpec, callback: u32, )
Record a text-object contribution (grammar.register-text-object).
Sourcepub fn record_action(
&mut self,
name: String,
doc: String,
spec: WitActionSpec,
callback: u32,
)
pub fn record_action( &mut self, name: String, doc: String, spec: WitActionSpec, callback: u32, )
Record an action contribution (grammar.register-action).
Sourcepub fn record_ex_command(
&mut self,
name: String,
doc: String,
spec: WitExCommandSpec,
parse_callback: u32,
apply_callback: u32,
)
pub fn record_ex_command( &mut self, name: String, doc: String, spec: WitExCommandSpec, parse_callback: u32, apply_callback: u32, )
Record an ex-command contribution (grammar.register-ex-command). Carries
two callbacks — parse-ex-args + apply-ex-command.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when the plugin registered no grammar (the degenerate case).
Sourcepub fn take(&mut self) -> Vec<RecordedContribution>
pub fn take(&mut self) -> Vec<RecordedContribution>
Drain the recorded contributions, leaving the accumulator empty. Called by
the host after register-grammar returns (PH7.7c) to build native specs.
Trait Implementations§
Source§impl Default for GrammarContributions
impl Default for GrammarContributions
Source§fn default() -> GrammarContributions
fn default() -> GrammarContributions
Auto Trait Implementations§
impl Freeze for GrammarContributions
impl RefUnwindSafe for GrammarContributions
impl Send for GrammarContributions
impl Sync for GrammarContributions
impl Unpin for GrammarContributions
impl UnsafeUnpin for GrammarContributions
impl UnwindSafe for GrammarContributions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more