#[repr(C)]pub struct RtcError {
pub error_type: RtcErrorType,
pub message: String,
pub error_detail: RtcErrorDetailType,
pub has_sctp_cause_code: bool,
pub sctp_cause_code: u16,
}Fields§
§error_type: RtcErrorType§message: String§error_detail: RtcErrorDetailType§has_sctp_cause_code: bool§sctp_cause_code: u16Implementations§
Source§impl RtcError
impl RtcError
Sourcepub fn parse(value: &str) -> Option<Self>
pub fn parse(value: &str) -> Option<Self>
Parse the hex-encoded error string the C++ side stuffs into the
cxx::Exception “what” message (see webrtc-sys/src/rtc_error.cpp
serialize_error). The format is fixed-width:
bytes 0..8 error_type (u32 hex)
bytes 8..16 error_detail (u32 hex)
bytes 16..18 has_sctp_cause_code (u8 hex, 0 or 1)
bytes 18..22 sctp_cause_code (u16 hex)
bytes 22.. message (raw, not encoded)Returns None if the input is shorter than the fixed header or the
header bytes aren’t valid hex. Discriminants outside the known
variants for RtcErrorType / RtcErrorDetailType fall back to
None for the affected field instead of being transmuted into
the enum (which is instant UB and what nightly’s
ptr::copy_nonoverlapping precondition check was firing on).
Sourcepub unsafe fn from(value: &str) -> Self
pub unsafe fn from(value: &str) -> Self
Backwards-compatible wrapper for callers that already trust the input is well-formed.
§Safety
Marked unsafe purely for source-compat with prior callers; the body
no longer relies on caller-upheld invariants.
pub fn ok(&self) -> bool
Trait Implementations§
Source§impl Error for RtcError
impl Error for RtcError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()