pub struct Interest {
pub name: Arc<Name>,
/* private fields */
}Expand description
An NDN Interest packet.
Fields beyond the name and selectors are lazily decoded via OnceLock
so that pipeline stages that short-circuit (e.g., CS hit) pay no decode cost
for fields they never access.
Fields§
§name: Arc<Name>Name — always decoded eagerly (every stage needs it).
Implementations§
Source§impl Interest
impl Interest
Sourcepub fn new(name: Name) -> Interest
pub fn new(name: Name) -> Interest
Construct a minimal Interest with only a name (for testing / app use).
Sourcepub fn decode(raw: Bytes) -> Result<Interest, PacketError>
pub fn decode(raw: Bytes) -> Result<Interest, PacketError>
Decode an Interest from raw wire bytes.
pub fn selectors(&self) -> &Selector
pub fn nonce(&self) -> Option<u32>
pub fn lifetime(&self) -> Option<Duration>
Sourcepub fn app_parameters(&self) -> Option<&Bytes>
pub fn app_parameters(&self) -> Option<&Bytes>
The ApplicationParameters TLV value (type 0x24), if present.
Returns None when the Interest was constructed without parameters (e.g.
via Interest::new) or when the wire format contains no 0x24 TLV.
Sourcepub fn forwarding_hint(&self) -> Option<&[Arc<Name>]>
pub fn forwarding_hint(&self) -> Option<&[Arc<Name>]>
ForwardingHint delegation names, if present.
Per NDN Packet Format v0.3 §5.2, ForwardingHint (TLV 0x1E) contains one or more Name TLVs representing delegation prefixes that a forwarder can use to reach the Data producer.
Sourcepub fn hop_limit(&self) -> Option<u8>
pub fn hop_limit(&self) -> Option<u8>
HopLimit value (0–255), if present in the wire format.
Per NDN Packet Format v0.3 §5.2, this is a 1-byte field. The forwarder must decrement before forwarding and drop if zero.
Sourcepub fn sig_info(&self) -> Option<&SignatureInfo>
pub fn sig_info(&self) -> Option<&SignatureInfo>
InterestSignatureInfo, if present (Signed Interest per NDN Packet Format v0.3 §5.4).
Sourcepub fn signed_region(&self) -> Option<&[u8]>
pub fn signed_region(&self) -> Option<&[u8]>
The signed region of a Signed Interest — from the start of Name TLV through the end of InterestSignatureInfo TLV (inclusive).
Returns None if InterestSignatureInfo is not present.