pub struct BrickWorkerMessage {
pub name: String,
pub direction: BrickWorkerMessageDirection,
pub fields: Vec<MessageField>,
pub trace_context: bool,
}Expand description
A worker message definition
Fields§
§name: StringMessage type name (PascalCase for Rust, lowercase for JS)
direction: BrickWorkerMessageDirectionDirection of the message
fields: Vec<MessageField>Message fields
trace_context: boolInclude trace context for distributed tracing
Implementations§
Source§impl BrickWorkerMessage
impl BrickWorkerMessage
Sourcepub fn new(
name: impl Into<String>,
direction: BrickWorkerMessageDirection,
) -> Self
pub fn new( name: impl Into<String>, direction: BrickWorkerMessageDirection, ) -> Self
Create a new worker message
Sourcepub fn field(self, name: impl Into<String>, field_type: FieldType) -> Self
pub fn field(self, name: impl Into<String>, field_type: FieldType) -> Self
Add a field to the message
Sourcepub fn optional_field(
self,
name: impl Into<String>,
field_type: FieldType,
) -> Self
pub fn optional_field( self, name: impl Into<String>, field_type: FieldType, ) -> Self
Add an optional field
Sourcepub fn without_trace(self) -> Self
pub fn without_trace(self) -> Self
Disable trace context for this message
Sourcepub fn js_type_name(&self) -> String
pub fn js_type_name(&self) -> String
Get the JavaScript type name (lowercase)
Sourcepub fn rust_type_name(&self) -> String
pub fn rust_type_name(&self) -> String
Get the Rust type name (PascalCase)
Trait Implementations§
Source§impl Clone for BrickWorkerMessage
impl Clone for BrickWorkerMessage
Source§fn clone(&self) -> BrickWorkerMessage
fn clone(&self) -> BrickWorkerMessage
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 BrickWorkerMessage
impl RefUnwindSafe for BrickWorkerMessage
impl Send for BrickWorkerMessage
impl Sync for BrickWorkerMessage
impl Unpin for BrickWorkerMessage
impl UnsafeUnpin for BrickWorkerMessage
impl UnwindSafe for BrickWorkerMessage
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