Skip to content

Commit 6c1ad0d

Browse files
d-e-s-oinsearchoflosttime
authored andcommitted
libbpf-rs: Refine signature of Program::attach_tracepoint()
The Program::attach_tracepoint() method is generic over the category and the tracepoint name. However, given that both arguments reference the same type parameter, they have to be of the same source type. That's an unnecessary restriction and almost certainly not the intention. Fix it up by making all type parameters independent of each other. Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent 0a3002a commit 6c1ad0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libbpf-rs/src/program.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,11 @@ impl Program {
430430

431431
/// Attach this program to a [kernel
432432
/// tracepoint](https://www.kernel.org/doc/html/latest/trace/tracepoints.html).
433-
pub fn attach_tracepoint<T: AsRef<str>>(&mut self, tp_category: T, tp_name: T) -> Result<Link> {
433+
pub fn attach_tracepoint(
434+
&mut self,
435+
tp_category: impl AsRef<str>,
436+
tp_name: impl AsRef<str>,
437+
) -> Result<Link> {
434438
let tp_category = util::str_to_cstring(tp_category.as_ref())?;
435439
let tp_category_ptr = tp_category.as_ptr();
436440
let tp_name = util::str_to_cstring(tp_name.as_ref())?;

0 commit comments

Comments
 (0)