pub struct WorkerBrick { /* private fields */ }Expand description
WorkerBrick: Generates Web Worker code from brick definition
Implementations§
Source§impl WorkerBrick
impl WorkerBrick
Sourcepub fn message(self, msg: BrickWorkerMessage) -> Self
pub fn message(self, msg: BrickWorkerMessage) -> Self
Add a message definition
Sourcepub fn transition(
self,
from: impl Into<String>,
message: impl Into<String>,
to: impl Into<String>,
) -> Self
pub fn transition( self, from: impl Into<String>, message: impl Into<String>, to: impl Into<String>, ) -> Self
Add a state transition
Sourcepub fn transition_with_action(
self,
from: impl Into<String>,
message: impl Into<String>,
to: impl Into<String>,
action: impl Into<String>,
) -> Self
pub fn transition_with_action( self, from: impl Into<String>, message: impl Into<String>, to: impl Into<String>, action: impl Into<String>, ) -> Self
Add a transition with action
Sourcepub fn to_worker_messages(&self) -> Vec<&BrickWorkerMessage>
pub fn to_worker_messages(&self) -> Vec<&BrickWorkerMessage>
Get messages sent to worker
Sourcepub fn from_worker_messages(&self) -> Vec<&BrickWorkerMessage>
pub fn from_worker_messages(&self) -> Vec<&BrickWorkerMessage>
Get messages sent from worker
Sourcepub fn to_worker_js(&self) -> String
pub fn to_worker_js(&self) -> String
Generate JavaScript Worker code
Sourcepub fn to_rust_bindings(&self) -> String
pub fn to_rust_bindings(&self) -> String
Generate Rust web_sys bindings
Sourcepub fn to_typescript_defs(&self) -> String
pub fn to_typescript_defs(&self) -> String
Generate TypeScript type definitions
Trait Implementations§
Source§impl Brick for WorkerBrick
impl Brick for WorkerBrick
Source§fn brick_name(&self) -> &'static str
fn brick_name(&self) -> &'static str
Get the brick’s unique type name
Source§fn assertions(&self) -> &[BrickAssertion]
fn assertions(&self) -> &[BrickAssertion]
Get all assertions for this brick
Source§fn budget(&self) -> BrickBudget
fn budget(&self) -> BrickBudget
Get the performance budget
Source§fn verify(&self) -> BrickVerification
fn verify(&self) -> BrickVerification
Verify all assertions against current state Read more
Source§fn can_render(&self) -> bool
fn can_render(&self) -> bool
Check if this brick can be rendered (all assertions pass)
Source§impl Clone for WorkerBrick
impl Clone for WorkerBrick
Source§fn clone(&self) -> WorkerBrick
fn clone(&self) -> WorkerBrick
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WorkerBrick
impl RefUnwindSafe for WorkerBrick
impl Send for WorkerBrick
impl Sync for WorkerBrick
impl Unpin for WorkerBrick
impl UnsafeUnpin for WorkerBrick
impl UnwindSafe for WorkerBrick
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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