pub struct Community(/* private fields */);Expand description
An SNMPv1 or SNMPv2c community identifier.
Library-provided structured Debug output always redacts the contained
bytes. The bytes remain available through Self::as_bytes and
Self::into_bytes for protocol and application use.
Communities use ordinary cloneable storage. They are not guaranteed to be zeroized, and SNMPv1/v2c transmits them in plaintext. Debug redaction avoids accidental disclosure through library diagnostics; it does not provide confidentiality on the wire or protect raw buffers, packet captures, application copies, or downstream formatting of explicitly accessed bytes.
Implementations§
Source§impl Community
impl Community
Sourcepub fn new(value: impl Into<Self>) -> Self
pub fn new(value: impl Into<Self>) -> Self
Construct a community from owned or copyable byte input.
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Consume the community and return its byte storage.
Sourcepub fn matches(&self, candidate: impl AsRef<[u8]>) -> bool
pub fn matches(&self, candidate: impl AsRef<[u8]>) -> bool
Return whether candidate contains the same community octets.
For equal-length inputs, comparison time does not depend on the octet
values. Length is not concealed: a length mismatch may return sooner.
Use this method instead of comparing Self::as_bytes when matching a
received community during authentication or authorization.