pub struct Extensions { /* private fields */ }
Expand description
A list of extensions with unique extension types.
Implementations§
Source§impl Extensions
impl Extensions
Sourcepub fn from_vec(
extensions: Vec<Extension>,
) -> Result<Self, InvalidExtensionError>
pub fn from_vec( extensions: Vec<Extension>, ) -> Result<Self, InvalidExtensionError>
Create an extension list with multiple extensions.
This function will fail when the list of extensions contains duplicate extension types.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Extension>
pub fn iter(&self) -> impl Iterator<Item = &Extension>
Returns an iterator over the extension list.
Sourcepub fn add(&mut self, extension: Extension) -> Result<(), InvalidExtensionError>
pub fn add(&mut self, extension: Extension) -> Result<(), InvalidExtensionError>
Add an extension to the extension list.
Returns an error when there already is an extension with the same extension type.
Sourcepub fn add_or_replace(&mut self, extension: Extension) -> Option<Extension>
pub fn add_or_replace(&mut self, extension: Extension) -> Option<Extension>
Add an extension to the extension list (or replace an existing one.)
Returns the replaced extension (if any).
Sourcepub fn remove(&mut self, extension_type: ExtensionType) -> Option<Extension>
pub fn remove(&mut self, extension_type: ExtensionType) -> Option<Extension>
Remove an extension from the extension list.
Returns the removed extension or None
when there is no extension with
the given extension type.
Sourcepub fn contains(&self, extension_type: ExtensionType) -> bool
pub fn contains(&self, extension_type: ExtensionType) -> bool
Returns true
iff the extension list contains an extension with the
given extension type.
Source§impl Extensions
impl Extensions
Sourcepub fn application_id(&self) -> Option<&ApplicationIdExtension>
pub fn application_id(&self) -> Option<&ApplicationIdExtension>
Get a reference to the ApplicationIdExtension
if there is any.
Sourcepub fn ratchet_tree(&self) -> Option<&RatchetTreeExtension>
pub fn ratchet_tree(&self) -> Option<&RatchetTreeExtension>
Get a reference to the RatchetTreeExtension
if there is any.
Sourcepub fn required_capabilities(&self) -> Option<&RequiredCapabilitiesExtension>
pub fn required_capabilities(&self) -> Option<&RequiredCapabilitiesExtension>
Get a reference to the RequiredCapabilitiesExtension
if there is
any.
Sourcepub fn external_pub(&self) -> Option<&ExternalPubExtension>
pub fn external_pub(&self) -> Option<&ExternalPubExtension>
Get a reference to the ExternalPubExtension
if there is any.
Sourcepub fn external_senders(&self) -> Option<&ExternalSendersExtension>
pub fn external_senders(&self) -> Option<&ExternalSendersExtension>
Get a reference to the ExternalSendersExtension
if there is any.
Sourcepub fn unknown(&self, extension_type_id: u16) -> Option<&UnknownExtension>
pub fn unknown(&self, extension_type_id: u16) -> Option<&UnknownExtension>
Get a reference to the UnknownExtension
with the given type id, if there is any.
Trait Implementations§
Source§impl Clone for Extensions
impl Clone for Extensions
Source§fn clone(&self) -> Extensions
fn clone(&self) -> Extensions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Extensions
impl Debug for Extensions
Source§impl Default for Extensions
impl Default for Extensions
Source§fn default() -> Extensions
fn default() -> Extensions
Source§impl<'de> Deserialize<'de> for Extensions
impl<'de> Deserialize<'de> for Extensions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Deserialize for Extensions
impl Deserialize for Extensions
Source§fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>where
Self: Sized,
fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>where
Self: Sized,
bytes
from the provided a std::io::Read
and returns the populated struct. Read moreSource§impl DeserializeBytes for Extensions
impl DeserializeBytes for Extensions
Source§impl PartialEq for Extensions
impl PartialEq for Extensions
Source§impl Serialize for Extensions
impl Serialize for Extensions
Source§impl Serialize for Extensions
impl Serialize for Extensions
Source§impl Size for &Extensions
impl Size for &Extensions
fn tls_serialized_len(&self) -> usize
Source§impl Size for Extensions
impl Size for Extensions
fn tls_serialized_len(&self) -> usize
impl Eq for Extensions
impl StructuralPartialEq for Extensions
Auto Trait Implementations§
impl Freeze for Extensions
impl RefUnwindSafe for Extensions
impl Send for Extensions
impl Sync for Extensions
impl Unpin for Extensions
impl UnwindSafe for Extensions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more