pub enum MockMessage {
Bootstrap {
base_url: String,
},
Init {
model_url: String,
},
Ready,
ModelLoaded {
size_mb: f64,
load_time_ms: f64,
},
Start {
sample_rate: u32,
},
Stop,
Partial {
text: String,
is_final: bool,
},
Error {
message: String,
},
Shutdown,
Custom {
msg_type: String,
payload: String,
},
}Expand description
Mock message types for testing worker communication
These mirror the actual message types used in WASM worker protocols.
§Serialization Requirement (PROBAR-WASM-003)
All messages implement Serialize and Deserialize to simulate
browser structuredClone semantics. Messages are round-tripped
through serialization in receive_message to catch non-serializable
payloads at test time.
Variants§
Bootstrap
Bootstrap message with base URL
Init
Initialization message with model URL
Ready
Worker ready signal
ModelLoaded
Model loaded successfully
Start
Start recording/processing
Stop
Stop recording/processing
Partial
Partial result
Error
Error occurred
Shutdown
Shutdown request
Custom
Custom message for extension
Implementations§
Source§impl MockMessage
impl MockMessage
Sourcepub fn model_loaded(size_mb: f64, load_time_ms: f64) -> Self
pub fn model_loaded(size_mb: f64, load_time_ms: f64) -> Self
Create a model loaded message
Trait Implementations§
Source§impl Clone for MockMessage
impl Clone for MockMessage
Source§fn clone(&self) -> MockMessage
fn clone(&self) -> MockMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockMessage
impl Debug for MockMessage
Source§impl<'de> Deserialize<'de> for MockMessage
impl<'de> Deserialize<'de> for MockMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 PartialEq for MockMessage
impl PartialEq for MockMessage
Source§impl Serialize for MockMessage
impl Serialize for MockMessage
impl StructuralPartialEq for MockMessage
Auto Trait Implementations§
impl Freeze for MockMessage
impl RefUnwindSafe for MockMessage
impl Send for MockMessage
impl Sync for MockMessage
impl Unpin for MockMessage
impl UnsafeUnpin for MockMessage
impl UnwindSafe for MockMessage
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