#[repr(C)]pub enum UPayloadFormat {
Unspecified = 0,
ProtobufWrappedInAny = 1,
Protobuf = 2,
Json = 3,
Someip = 4,
SomeipTlv = 5,
Raw = 6,
Text = 7,
Shm = 8,
}Expand description
Payload serialization formats defined by the uProtocol specification.
Variants§
Unspecified = 0
No format specified; receivers must not assume a serialization.
ProtobufWrappedInAny = 1
Protobuf message wrapped in google.protobuf.Any.
Protobuf = 2
Protobuf message bytes.
Json = 3
JSON text.
Someip = 4
SOME/IP serialized payload.
SomeipTlv = 5
SOME/IP TLV serialized payload.
Raw = 6
Raw application-defined bytes.
Text = 7
UTF-8 text.
Shm = 8
Shared-memory reference payload.
Implementations§
Source§impl UPayloadFormat
impl UPayloadFormat
Sourcepub fn as_i32(&self) -> i32
pub fn as_i32(&self) -> i32
Returns the integer value of the payload format as defined in the protobuf enum.
Sourcepub fn try_from_i32(value: i32) -> Result<UPayloadFormat, SerializationError>
pub fn try_from_i32(value: i32) -> Result<UPayloadFormat, SerializationError>
Source§impl UPayloadFormat
impl UPayloadFormat
Sourcepub fn from_media_type(media_type_string: &str) -> Result<Self, UPayloadError>
pub fn from_media_type(media_type_string: &str) -> Result<Self, UPayloadError>
Gets the payload format that corresponds to a given media type.
§Errors
Returns an error if the given string is not a valid media type string or is unsupported by uProtocol.
§Examples
use up_rust::UPayloadFormat;
let parse_attempt = UPayloadFormat::from_media_type("application/json; charset=utf-8");
assert!(parse_attempt.is_ok_and(|f| f == UPayloadFormat::Json));
let parse_attempt = UPayloadFormat::from_media_type("application/unsupported");
assert!(parse_attempt.is_err());Sourcepub fn to_media_type(self) -> Option<String>
pub fn to_media_type(self) -> Option<String>
Gets the media type corresponding to this payload format.
§Returns
None if the payload format is UPayloadFormat::Unspecified.
§Examples
use up_rust::UPayloadFormat;
assert_eq!(UPayloadFormat::Json.to_media_type().unwrap(), "application/json");
assert!(UPayloadFormat::Unspecified.to_media_type().is_none());Trait Implementations§
Source§impl Clone for UPayloadFormat
impl Clone for UPayloadFormat
Source§fn clone(&self) -> UPayloadFormat
fn clone(&self) -> UPayloadFormat
Returns a copy 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 UPayloadFormat
impl Debug for UPayloadFormat
Source§impl Hash for UPayloadFormat
impl Hash for UPayloadFormat
Source§impl PartialEq for UPayloadFormat
impl PartialEq for UPayloadFormat
impl Copy for UPayloadFormat
impl Eq for UPayloadFormat
impl StructuralPartialEq for UPayloadFormat
Auto Trait Implementations§
impl Freeze for UPayloadFormat
impl RefUnwindSafe for UPayloadFormat
impl Send for UPayloadFormat
impl Sync for UPayloadFormat
impl Unpin for UPayloadFormat
impl UnwindSafe for UPayloadFormat
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.