Skip to content

Commit 88c8ed4

Browse files
committed
libbpf-cargo: Expose inner Rust "enum" values publicly
With the switch from emitting C enums as Rust enums to mapping them to Rust structs instead, we no longer allow access to the underlying integer. That's a bit of a usability snag, because it forces users to fall back to transmuting constants just to get a hold of the inner value. Expose the inner value publicly to make that easier. Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent f515e71 commit 88c8ed4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libbpf-cargo/src/gen/btf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ impl<'s> GenBtf<'s> {
810810

811811
writeln!(def, r#"#[derive(Debug, Copy, Clone, Eq, PartialEq)]"#)?;
812812
writeln!(def, r#"#[repr(transparent)]"#)?;
813-
writeln!(def, r#"pub struct {enum_name}({signed}{repr_size});"#)?;
813+
writeln!(def, r#"pub struct {enum_name}(pub {signed}{repr_size});"#)?;
814814
writeln!(def, "#[allow(non_upper_case_globals)]")?;
815815
writeln!(def, r#"impl {enum_name} {{"#,)?;
816816

0 commit comments

Comments
 (0)