Struct ockam_multiaddr::MultiAddr
source · pub struct MultiAddr { /* private fields */ }
Expand description
A sequence of Protocol
s.
Implementations§
source§impl 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<'b>(&mut self) -> Option<ProtoValue<'b>>
pub fn pop_back<'b>(&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 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
.
sourcepub fn matches<'a, I>(&self, start: usize, codes: I) -> boolwhere
I: IntoIterator<Item = &'a Match>,
I::IntoIter: ExactSizeIterator,
pub fn matches<'a, I>(&self, start: usize, codes: I) -> boolwhere I: IntoIterator<Item = &'a Match>, I::IntoIter: ExactSizeIterator,
Check if the protocol codes match the given sequence.
pub fn split(&self, at: usize) -> (MultiAddr, MultiAddr)
pub fn concat_mut(&mut self, other: &MultiAddr) -> Result<(), Error>
pub fn concat(self, other: &MultiAddr) -> Result<MultiAddr, Error>
Trait Implementations§
source§impl<'a> IntoIterator for &'a MultiAddr
impl<'a> IntoIterator for &'a MultiAddr
source§impl 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§
source§impl<D> AsyncTryClone for Dwhere
D: Clone + Sync,
impl<D> AsyncTryClone for Dwhere D: Clone + Sync,
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> ToHex for Twhere
T: AsRef<[u8]>,
impl<T> ToHex for Twhere T: AsRef<[u8]>,
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)