Struct ockam_multiaddr::MultiAddr
source · [−]pub struct MultiAddr { /* private fields */ }
Expand description
A sequence of Protocol
s.
Implementations
sourceimpl MultiAddr
impl MultiAddr
sourcepub fn new(r: Registry) -> Self
pub fn new(r: Registry) -> Self
Create an empty address with an explicit protocol codec registry.
sourcepub fn try_from_str(input: &str, r: Registry) -> Result<Self, Error>
pub fn try_from_str(input: &str, r: Registry) -> Result<Self, Error>
Try to parse the given string as a multi-address.
Alternative to the corresponding TryFrom
impl, accepting an explicit
protocol codec registry.
sourcepub fn try_from_bytes(input: &[u8], r: Registry) -> Result<Self, Error>
pub fn try_from_bytes(input: &[u8], r: Registry) -> Result<Self, Error>
Try to decode the given bytes as a multi-address.
Alternative to the corresponding TryFrom
impl, accepting an explicit
protocol codec registry.
sourcepub fn push_back<'a, P: Protocol<'a>>(&mut self, p: P) -> Result<(), Error>
pub fn push_back<'a, P: Protocol<'a>>(&mut self, p: P) -> Result<(), Error>
Add a protocol to the end of this address.
sourcepub fn push_back_value(&mut self, p: &ProtoValue<'_>) -> Result<(), Error>
pub fn push_back_value(&mut self, p: &ProtoValue<'_>) -> Result<(), Error>
Add a protocol value to the end of this address.
sourcepub fn push_front<'a, P: Protocol<'a>>(&mut self, p: P) -> Result<(), Error>
pub fn push_front<'a, P: Protocol<'a>>(&mut self, p: P) -> Result<(), Error>
Add a protocol to the front of this address.
sourcepub fn push_front_value(&mut self, p: &ProtoValue<'_>) -> Result<(), Error>
pub fn push_front_value(&mut self, p: &ProtoValue<'_>) -> Result<(), Error>
Add a protocol value to the front of this address.
sourcepub fn pop_back<'a, 'b>(&'a mut self) -> Option<ProtoValue<'b>>
pub fn pop_back<'a, 'b>(&'a mut self) -> Option<ProtoValue<'b>>
Remove and return the last protocol component.
O(n) in the number of protocols.
sourcepub fn pop_front(&mut self) -> Option<ProtoValue<'_>>
pub fn pop_front(&mut self) -> Option<ProtoValue<'_>>
Remove and return the first protocol component.
sourcepub fn drop_first(&mut self)
pub fn drop_first(&mut self)
Remove the first protocol component.
sourcepub fn drop_last(&mut self)
pub fn drop_last(&mut self)
Remove the last protocol component.
O(n) in the number of protocols.
sourcepub fn first(&self) -> Option<ProtoValue<'_>>
pub fn first(&self) -> Option<ProtoValue<'_>>
Return a reference to the first protocol component.
sourcepub fn last(&self) -> Option<ProtoValue<'_>>
pub fn last(&self) -> Option<ProtoValue<'_>>
Return a reference to the last protocol component.
O(n) in the number of protocols.
sourcepub fn iter(&self) -> ProtoIter<'_>ⓘNotable traits for ProtoIter<'a>impl<'a> Iterator for ProtoIter<'a> type Item = ProtoValue<'a>;
pub fn iter(&self) -> ProtoIter<'_>ⓘNotable traits for ProtoIter<'a>impl<'a> Iterator for ProtoIter<'a> type Item = ProtoValue<'a>;
Get an iterator over the protocol components.
sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Drop any excess capacity.
sourcepub fn try_extend<'a, T>(&mut self, iter: T) -> Result<(), Error>where
T: IntoIterator<Item = ProtoValue<'a>>,
pub fn try_extend<'a, T>(&mut self, iter: T) -> Result<(), Error>where
T: IntoIterator<Item = ProtoValue<'a>>,
Try to extend this multi-address with another sequence of protocols.
sourcepub fn try_with<'a, T>(self, iter: T) -> Result<Self, Error>where
T: IntoIterator<Item = ProtoValue<'a>>,
pub fn try_with<'a, T>(self, iter: T) -> Result<Self, Error>where
T: IntoIterator<Item = ProtoValue<'a>>,
Like try_extend
but moves Self
.
Trait Implementations
sourceimpl<'a> IntoIterator for &'a MultiAddr
impl<'a> IntoIterator for &'a MultiAddr
sourceimpl PartialEq<MultiAddr> for MultiAddr
impl PartialEq<MultiAddr> for MultiAddr
impl Eq for MultiAddr
Auto Trait Implementations
impl !RefUnwindSafe for MultiAddr
impl Send for MultiAddr
impl Sync for MultiAddr
impl Unpin for MultiAddr
impl !UnwindSafe for MultiAddr
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more