Skip to content

Commit 050408c

Browse files
d-e-s-oinsearchoflosttime
authored andcommitted
libbpf-rs: Refine signature of Program::attach_usdt()
The Program::attach_usdt() method is generic over the USDT provider name and the USDT 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 732cddc commit 050408c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libbpf-rs/src/program.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,12 @@ impl Program {
491491
/// Attach this program to a [USDT](https://lwn.net/Articles/753601/) probe
492492
/// point. The entry point of the program must be defined with
493493
/// `SEC("usdt")`.
494-
pub fn attach_usdt<S: AsRef<str>, T: AsRef<Path>>(
494+
pub fn attach_usdt(
495495
&mut self,
496496
pid: i32,
497-
binary_path: T,
498-
usdt_provider: S,
499-
usdt_name: S,
497+
binary_path: impl AsRef<Path>,
498+
usdt_provider: impl AsRef<str>,
499+
usdt_name: impl AsRef<str>,
500500
) -> Result<Link> {
501501
let path = util::path_to_cstring(binary_path.as_ref())?;
502502
let path_ptr = path.as_ptr();

0 commit comments

Comments
 (0)