mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-02 11:11:36 +00:00
*: Apply clippy suggestions and enable clippy on CI (#1850)
* *: Apply clippy suggestions * .github: Add clippy check * protocols/kad/record: Implement custom PartialEq for ProviderRecord
This commit is contained in:
@ -40,6 +40,7 @@ static_assertions::const_assert! {
|
||||
}
|
||||
|
||||
/// Representation of a Multiaddr.
|
||||
#[allow(clippy::rc_buffer)]
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
|
||||
pub struct Multiaddr { bytes: Arc<Vec<u8>> }
|
||||
|
||||
@ -59,6 +60,11 @@ impl Multiaddr {
|
||||
self.bytes.len()
|
||||
}
|
||||
|
||||
/// Returns true if the length of this multiaddress is 0.
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.bytes.len() == 0
|
||||
}
|
||||
|
||||
/// Return a copy of this [`Multiaddr`]'s byte representation.
|
||||
pub fn to_vec(&self) -> Vec<u8> {
|
||||
Vec::from(&self.bytes[..])
|
||||
|
Reference in New Issue
Block a user