Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some missing methods/trait bounds #318

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/base/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,10 @@ impl<Octs: Octets + ?Sized> Message<Octs> {
/// The method checks whether the ID fields of the headers are the same,
/// whether the QR flag is set in this message, and whether the questions
/// are the same.
pub fn is_answer<Other: Octets>(&self, query: &Message<Other>) -> bool {
pub fn is_answer<Other: Octets + ?Sized>(
&self,
query: &Message<Other>,
) -> bool {
if !self.header().qr()
|| self.header().id() != query.header().id()
|| self.header_counts().qdcount()
Expand Down
13 changes: 13 additions & 0 deletions src/base/message_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,11 @@ impl<'a, Target: Composer + ?Sized> OptBuilder<'a, Target> {
let start = self.start;
OptHeader::for_record_slice_mut(&mut self.target.as_mut()[start..])
}

/// Returns a reference to the underlying octets builder.
pub fn as_target(&self) -> &Target {
self.target
}
}

//------------ StreamTarget --------------------------------------------------
Expand Down Expand Up @@ -2047,6 +2052,14 @@ impl<Target: Truncate> Truncate for StaticCompressor<Target> {
}
}

impl<Target: FreezeBuilder> FreezeBuilder for StaticCompressor<Target> {
type Octets = Target::Octets;

fn freeze(self) -> Self::Octets {
self.target.freeze()
}
}

//------------ TreeCompressor ------------------------------------------------

/// A domain name compressor that uses a tree.
Expand Down
Loading