aya-log-pbf-macros: ensure WriteToBuf is used

Previously any old `write` method could be selected.
pull/585/head
Tamir Duberstein 2 years ago
parent 490d7d587a
commit 4d098ef413
No known key found for this signature in database

@ -151,12 +151,11 @@ pub(crate) fn log(args: LogArgs, level: Option<TokenStream>) -> Result<TokenStre
let record_len = header_len; let record_len = header_len;
if let Ok(record_len) = { if let Ok(record_len) = {
use ::aya_log_ebpf::WriteToBuf;
Ok::<_, ()>(record_len) #( .and_then(|record_len| { Ok::<_, ()>(record_len) #( .and_then(|record_len| {
if record_len >= buf.buf.len() { if record_len >= buf.buf.len() {
return Err(()); return Err(());
} }
{ #values_iter }.write(&mut buf.buf[record_len..]).map(|len| record_len + len) aya_log_ebpf::WriteToBuf::write({ #values_iter }, &mut buf.buf[record_len..]).map(|len| record_len + len)
}) )* }) )*
} { } {
unsafe { ::aya_log_ebpf::AYA_LOGS.output( unsafe { ::aya_log_ebpf::AYA_LOGS.output(

Loading…
Cancel
Save