Skip to main content

TransportError

Enum TransportError 

Source
pub enum TransportError {
Show 32 variants ConnectionFailed, Disconnected, PublisherCreationFailed, SubscriberCreationFailed, ServiceServerCreationFailed, ServiceClientCreationFailed, PublishFailed, ServiceRequestFailed, ServiceReplyFailed, SerializationError, DeserializationError, BufferTooSmall, MessageTooLarge, Timeout, InvalidConfig, WouldBlock, TooLarge, TaskStartFailed, PollFailed, KeepaliveFailed, JoinFailed, InvalidArgument, Unsupported, BadAlloc, IncompatibleQos(QoSPolicyMask), TopicNameInvalid, NodeNameNonExistent, LoanNotSupported, NoData, IncompatibleAbi, Backend(&'static str), BackendDynamic(String),
}
Expand description

Transport error types.

No longer Copy — the Backend / BackendDynamic variants carry a string diagnostic, which can’t be Copy. Rust callers that used to copy a TransportError value repeatedly now need .clone() or ref in match arms. C/C++ callers are unaffected — both map TransportError to integer codes (rcl_ret_t / ErrorCode) before crossing the FFI boundary.

Variants§

§

ConnectionFailed

Failed to connect to transport

§

Disconnected

Connection was closed

§

PublisherCreationFailed

Failed to create publisher

§

SubscriberCreationFailed

Failed to create subscriber

§

ServiceServerCreationFailed

Failed to create service server

§

ServiceClientCreationFailed

Failed to create service client

§

PublishFailed

Failed to publish message

§

ServiceRequestFailed

Failed to send service request

§

ServiceReplyFailed

Failed to send service reply

§

SerializationError

Serialization error

§

DeserializationError

Deserialization error

§

BufferTooSmall

Buffer too small

§

MessageTooLarge

Incoming message exceeded the static buffer capacity

§

Timeout

Timeout waiting for message

§

InvalidConfig

Invalid configuration

§

WouldBlock

Resource (slot, buffer, queue) momentarily unavailable. Retry. Phase 99: returned by try_loan when arena slots are full and by try_borrow when no message is ready (alternative to Ok(None) for backends that prefer the error variant).

§

TooLarge

Requested allocation exceeds backend capacity. Phase 99: try_loan(len) returns this when len > arena slot size.

§

TaskStartFailed

Failed to start background tasks

§

PollFailed

Failed to poll for incoming messages

§

KeepaliveFailed

Failed to send keepalive

§

JoinFailed

Failed to send join message

§

InvalidArgument

Caller supplied a NULL pointer, an out-of-range value, or an inconsistent argument combination. Phase 102.1.

§

Unsupported

The backend does not implement this operation. Optional callbacks return this; the runtime then falls back to a default path. Phase 102.1.

§

BadAlloc

Memory allocation failed. Returned by backends on std / alloc-equipped platforms when heap allocation fails. Bare-metal backends generally do not produce this — they preallocate at session-open time. Phase 102.1.

§

IncompatibleQos(QoSPolicyMask)

Publisher and subscriber QoS profiles do not match in a way the backend cannot reconcile. Phase 102.1.

It NAMES the policy — phase-417 G7. The payload is the single QoSPolicyMask bit that was refused, so err.qos_policy_name() (or mask.policy_name()) turns the refusal into "RELIABILITY" without an allocator. Until this carried a payload, QoSProfile::validate_against computed the offending bit and threw it away, while rmw_vtable.h’s supported_qos_policies block told the reader those creates fail “naming a policy”. They did not. Issue 1329’s NONE-over-union choice rests on that sentence, so the choice was right and its evidence was not yet true.

QoSPolicyMask::NONE is the honest answer where the refusal crossed a boundary that cannot carry one — a C backend returns NROS_RMW_RET_INCOMPATIBLE_QOS, an rmw_ret_t with no room for a mask — and policy_name() then answers None rather than naming a policy nobody identified.

§

TopicNameInvalid

Topic, service, or action name failed validation. Phase 102.1.

§

NodeNameNonExistent

A request referenced a node that does not exist in this session. Phase 102.1.

§

LoanNotSupported

The backend does not support loaned messages on this entity, or the loan slot is currently in use. Phase 102.1.

§

NoData

No data was available on a non-blocking receive. Distinct from Timeout: fires immediately, not after a bounded wait. Phase 102.1.

§

IncompatibleAbi

Phase 115.A.2 — caller passed a versioned vtable struct (e.g. NrosTransportOps) with an abi_version the runtime doesn’t know. Maps to NROS_RMW_RET_INCOMPATIBLE_ABI at the C boundary.

§

Backend(&'static str)

Backend-specific error with a 'static diagnostic string.

Useful for zenoh-pico / XRCE-DDS return codes that map to a fixed set of known messages. no_std-compatible.

§

BackendDynamic(String)

Backend-specific error with an owned diagnostic string.

Available only with the alloc feature. Use this when the diagnostic is formatted at runtime (e.g. from a C error code plus a socket address).

Implementations§

Source§

impl TransportError

Source

pub fn qos_policy_name(&self) -> Option<&'static str>

The QoS policy this error names, or None.

phase-417 G7 — the one accessor the three surfaces share. Some only for Self::IncompatibleQos carrying exactly one QoSPolicyMask bit; None for every other error, and for a refusal that crossed a boundary with no room for the mask.

The string is borrowed from QoSPolicyMask::NAMED, so this costs no allocator and no formatter and is available on a bare-metal target.

Trait Implementations§

Source§

impl Clone for TransportError

Source§

fn clone(&self) -> TransportError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TransportError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for TransportError

One line per variant, in the defining crate, so every consumer renders the same words (issue 0783: NodeError used to fall back to {:?} because this impl did not exist, and writing the prose there would have put a backend’s wording in the wrong crate). no_std: no allocator, only write_str and the payloads the variants already carry.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for TransportError

Source§

impl From<TransportError> for LoanError

Source§

fn from(e: TransportError) -> LoanError

Converts to this type from the input type.
Source§

impl From<TransportError> for NodeError

Source§

fn from(err: TransportError) -> NodeError

Converts to this type from the input type.
Source§

impl PartialEq for TransportError

Source§

fn eq(&self, other: &TransportError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TransportError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.