pub struct StreamError {
pub condition: DefinedCondition,
pub texts: BTreeMap<Lang, String>,
pub application_specific: Vec<Element>,
}
Expand description
Stream error as specified in RFC 6120.
Fields§
§condition: DefinedCondition
The enumerated error condition which triggered this stream error.
texts: BTreeMap<Lang, String>
Optional error text
application_specific: Vec<Element>
Optional application-defined element which refines the specified
Self::condition
.
Implementations§
Source§impl StreamError
impl StreamError
Sourcepub fn new<S: Into<String>, L: Into<Lang>>(
condition: DefinedCondition,
lang: L,
text: S,
) -> Self
pub fn new<S: Into<String>, L: Into<Lang>>( condition: DefinedCondition, lang: L, text: S, ) -> Self
Create a new StreamError with condition, text, and language
Sourcepub fn add_text<L: Into<Lang>, S: Into<String>>(self, lang: L, text: S) -> Self
pub fn add_text<L: Into<Lang>, S: Into<String>>(self, lang: L, text: S) -> Self
Add a text element with the specified language
Sourcepub fn with_application_specific(
self,
application_specific: Vec<Element>,
) -> Self
pub fn with_application_specific( self, application_specific: Vec<Element>, ) -> Self
Append application specific element(s)
Sourcepub fn get_best_text(
&self,
preferred_langs: Vec<&str>,
) -> Option<(Lang, &String)>
pub fn get_best_text( &self, preferred_langs: Vec<&str>, ) -> Option<(Lang, &String)>
Get the best matching text from a list of preferred languages.
This follows the same logic as Message::get_best_body:
- First tries to find a match from the preferred languages list
- Falls back to empty language (“”) if available
- Returns the first entry if no matches found
Returns None if no text elements exist.
Sourcepub fn get_best_text_cloned(
&self,
preferred_langs: Vec<&str>,
) -> Option<(Lang, String)>
pub fn get_best_text_cloned( &self, preferred_langs: Vec<&str>, ) -> Option<(Lang, String)>
Cloned variant of StreamError::get_best_text
Trait Implementations§
Source§impl AsXml for StreamError
impl AsXml for StreamError
Source§impl Clone for StreamError
impl Clone for StreamError
Source§fn clone(&self) -> StreamError
fn clone(&self) -> StreamError
Returns a duplicate 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 StreamError
impl Debug for StreamError
Source§impl Display for StreamError
impl Display for StreamError
Source§impl From<&StreamError> for Element
impl From<&StreamError> for Element
Source§fn from(other: &StreamError) -> Self
fn from(other: &StreamError) -> Self
Converts to this type from the input type.
Source§impl From<HandledCountTooHigh> for StreamError
impl From<HandledCountTooHigh> for StreamError
Source§fn from(other: HandledCountTooHigh) -> Self
fn from(other: HandledCountTooHigh) -> Self
Converts to this type from the input type.
Source§impl From<StreamError> for Element
impl From<StreamError> for Element
Source§fn from(other: StreamError) -> Self
fn from(other: StreamError) -> Self
Converts to this type from the input type.
Source§impl FromXml for StreamError
impl FromXml for StreamError
Source§type Builder = StreamErrorFromXmlBuilder
type Builder = StreamErrorFromXmlBuilder
A builder type used to construct the element. Read more
Source§fn from_events(
name: QName,
attrs: AttrMap,
ctx: &Context<'_>,
) -> Result<Self::Builder, FromEventsError>
fn from_events( name: QName, attrs: AttrMap, ctx: &Context<'_>, ) -> Result<Self::Builder, FromEventsError>
Attempt to initiate the streamed construction of this struct from XML. Read more
Source§fn xml_name_matcher() -> XmlNameMatcher<'static>
fn xml_name_matcher() -> XmlNameMatcher<'static>
Return a predicate which determines if
Self
may be parsed from
a given XML element. Read moreSource§impl PartialEq for StreamError
impl PartialEq for StreamError
Source§impl TryFrom<Element> for StreamError
impl TryFrom<Element> for StreamError
Source§type Error = FromElementError
type Error = FromElementError
The type returned in the event of a conversion error.
impl StructuralPartialEq for StreamError
Auto Trait Implementations§
impl Freeze for StreamError
impl RefUnwindSafe for StreamError
impl Send for StreamError
impl Sync for StreamError
impl Unpin for StreamError
impl UnwindSafe for StreamError
Blanket Implementations§
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,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString
. Read more