pub struct UnknownAttributes { /* private fields */ }
Expand description

The UnknownAttributes Attribute

Implementations§

Create a new unknown attributes Attribute

Examples
let unknown = UnknownAttributes::new(&[USERNAME]);
assert!(unknown.has_attribute(USERNAME));
Examples found in repository?
src/stun/message.rs (line 1016)
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
    pub fn unknown_attributes(
        src: &Message,
        attributes: &[AttributeType],
    ) -> Result<Message, StunError> {
        let mut out = Message::new_error(src);
        out.add_attribute(Software::new("stund - librice v0.1")?)?;
        out.add_attribute(ErrorCode::new(420, "Unknown Attributes")?)?;
        if !attributes.is_empty() {
            out.add_attribute(UnknownAttributes::new(attributes))?;
        }
        Ok(out)
    }

Add an AttributeType that is unsupported

Examples
let mut unknown = UnknownAttributes::new(&[]);
unknown.add_attribute(USERNAME);
assert!(unknown.has_attribute(USERNAME));

Check if an AttributeType is present

Examples
let unknown = UnknownAttributes::new(&[USERNAME]);
assert!(unknown.has_attribute(USERNAME));
Examples found in repository?
src/stun/attribute.rs (line 733)
732
733
734
735
736
    pub fn add_attribute(&mut self, attr: AttributeType) {
        if !self.has_attribute(attr) {
            self.attributes.push(attr);
        }
    }

Trait Implementations§

Retrieve the AttributeType of an Attribute
Retrieve the length of an Attribute. This is not the padded length as stored in a Message
Convert an Attribute to a RawAttribute
Convert an Attribute from a RawAttribute
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more