pub trait BuilderState: Sealed {
// Provided method
fn merge_into_attributes(&self, _attributes: &mut UAttributes) { ... }
}Expand description
Represents the type of message being built by a UMessageBuilder.
This is used to limit the available builder functions and to ensure that the
builder is used in a consistent way.
For example, only a builder for a request message can set the permission_level and token attributes
and only a builder for a response message can set the comm_status and request_id attributes.
This is achieved by having different builder state types for each message type and by using the
BuilderState::merge_into_attributes function to add the state-specific attributes to the
final message attributes when building the message.
Note: Only this crate can provide implementations of Self because of the dependency on a sealed trait. This is relevant because otherwise, external crates could add custom constructor functions to UMessageBuilder that return malicious implementations of Self which might produce invalid UMessage instances by means of the Self::merge_into_attributes function.
Provided Methods§
Sourcefn merge_into_attributes(&self, _attributes: &mut UAttributes)
fn merge_into_attributes(&self, _attributes: &mut UAttributes)
The merge into attributes.