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
impl TransportError
Sourcepub fn qos_policy_name(&self) -> Option<&'static str>
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
impl Clone for TransportError
Source§fn clone(&self) -> TransportError
fn clone(&self) -> TransportError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransportError
impl Debug for TransportError
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.
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.