pub enum UAttributesValidators {
Publish,
Notification,
Request,
Response,
}Expand description
Enum that hold the implementations of uattributesValidator according to type.
Variants§
Publish
Validates publish-message attributes.
Notification
Validates notification-message attributes.
Request
Validates request-message attributes.
Response
Validates response-message attributes.
Implementations§
Source§impl UAttributesValidators
impl UAttributesValidators
Sourcepub fn validator(&self) -> Box<dyn UAttributesValidator>
pub fn validator(&self) -> Box<dyn UAttributesValidator>
Gets the validator corresponding to this enum value.
§Examples
use up_rust::{UAttributesValidators, UMessageBuilder, UUri};
let topic = UUri::try_from("//my-vehicle/D45/23/A001")?;
let msg = UMessageBuilder::publish(topic).build()?;
let validator = UAttributesValidators::Publish.validator();
assert!(validator.validate(msg.attributes()).is_ok());Sourcepub fn validator_for_attributes(
attributes: &UAttributes,
) -> Box<dyn UAttributesValidator>
pub fn validator_for_attributes( attributes: &UAttributes, ) -> Box<dyn UAttributesValidator>
Gets a validator that can be used to check a given set of attributes.
§Examples
use up_rust::{UAttributesValidators, UMessageBuilder, UMessageType, UUri};
let topic = UUri::try_from("//my-vehicle/D45/23/A001")?;
let msg = UMessageBuilder::publish(topic).build()?;
let validator = UAttributesValidators::validator_for_attributes(msg.attributes());
assert!(validator.validate(msg.attributes()).is_ok());Sourcepub fn validator_for(
message_type: UMessageType,
) -> Box<dyn UAttributesValidator>
pub fn validator_for( message_type: UMessageType, ) -> Box<dyn UAttributesValidator>
Gets a validator that can be used to check attributes of a given type of message.
§Examples
use up_rust::{UAttributesValidators, UMessageBuilder, UMessageType, UUri};
let topic = UUri::try_from("//my-vehicle/D45/23/A001")?;
let msg = UMessageBuilder::publish(topic).build()?;
let validator = UAttributesValidators::validator_for(UMessageType::Publish);
assert!(validator.validate(msg.attributes()).is_ok());Sourcepub fn get_validator(
message_type: UMessageType,
) -> Box<dyn UAttributesValidator>
👎Deprecated since 0.11.0: renamed to validator_for
pub fn get_validator( message_type: UMessageType, ) -> Box<dyn UAttributesValidator>
validator_forDeprecated alias for Self::validator_for.
Sourcepub fn get_validator_for_attributes(
attributes: &UAttributes,
) -> Box<dyn UAttributesValidator>
👎Deprecated since 0.11.0: renamed to validator_for_attributes
pub fn get_validator_for_attributes( attributes: &UAttributes, ) -> Box<dyn UAttributesValidator>
validator_for_attributesDeprecated alias for Self::validator_for_attributes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UAttributesValidators
impl RefUnwindSafe for UAttributesValidators
impl Send for UAttributesValidators
impl Sync for UAttributesValidators
impl Unpin for UAttributesValidators
impl UnwindSafe for UAttributesValidators
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<TCore> UWithNativePrefixWire for TCore
impl<TCore> UWithNativePrefixWire for TCore
Source§fn into_native_prefix_wire_transport<W>(
self,
wire: W,
) -> UWireTransport<TCore, W, NativePrefixFrameMetadataCodec>where
W: UWire,
fn into_native_prefix_wire_transport<W>(
self,
wire: W,
) -> UWireTransport<TCore, W, NativePrefixFrameMetadataCodec>where
W: UWire,
Wraps this core with an external or custom selected wire using canonical metadata.
Source§fn into_protobuf_transport(
self,
) -> UWireTransport<TCore, ProtobufWire, NativePrefixFrameMetadataCodec>
fn into_protobuf_transport( self, ) -> UWireTransport<TCore, ProtobufWire, NativePrefixFrameMetadataCodec>
Wraps this core with the Protocol Buffers selected-wire profile.
Source§fn into_stable_container_transport(
self,
) -> UWireTransport<TCore, StableContainerWireFormat, NativePrefixFrameMetadataCodec>
fn into_stable_container_transport( self, ) -> UWireTransport<TCore, StableContainerWireFormat, NativePrefixFrameMetadataCodec>
Wraps this core with the stable-container selected-wire profile.