diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e6787ab..6fcf14b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Upcoming Release +- [[#91]](https://github.com/rust-vmm/seccompiler/pull/91): Actually make + `JsonFrontendError` type publicly accessible, this type is referred to in a + public variant of `Error` but was not accessible outside the crate. + # v0.5.0 ## Added diff --git a/Cargo.toml b/Cargo.toml index 7bd697a4..7059a176 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,10 @@ keywords = ["seccomp", "jail", "sandbox"] license = "Apache-2.0 OR BSD-3-Clause" edition = "2021" +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + [features] json = ["serde", "serde_json"] diff --git a/src/frontend/json.rs b/src/frontend/json.rs index 6b68ed31..25ad5007 100644 --- a/src/frontend/json.rs +++ b/src/frontend/json.rs @@ -31,6 +31,7 @@ use serde::{Deserialize, Deserializer}; type Result = result::Result; /// Error compiling JSON into IR. +#[cfg_attr(docsrs, doc(cfg(feature = "json")))] #[derive(Debug)] pub enum Error { /// Backend error creating the `SeccompFilter` IR. diff --git a/src/lib.rs b/src/lib.rs index ca9d8c23..8b5706ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -185,6 +185,8 @@ //! [`SeccompRule`]: struct.SeccompRule.html //! [`SeccompAction`]: enum.SeccompAction.html +#![cfg_attr(docsrs, feature(doc_cfg))] + mod backend; #[cfg(feature = "json")] mod frontend; @@ -200,8 +202,11 @@ use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::io; +#[cfg_attr(docsrs, doc(cfg(feature = "json")))] +#[cfg(feature = "json")] +pub use frontend::json::Error as JsonFrontendError; #[cfg(feature = "json")] -use frontend::json::{Error as JsonFrontendError, JsonCompiler}; +use frontend::json::JsonCompiler; // Re-export the IR public types. pub use backend::{ @@ -238,6 +243,7 @@ pub enum Error { /// of the thread that caused the failure. ThreadSync(libc::c_long), /// Json Frontend Error. + #[cfg_attr(docsrs, doc(cfg(feature = "json")))] #[cfg(feature = "json")] JsonFrontend(JsonFrontendError), } @@ -295,6 +301,7 @@ impl From for Error { Self::Backend(value) } } +#[cfg_attr(docsrs, doc(cfg(feature = "json")))] #[cfg(feature = "json")] impl From for Error { fn from(value: JsonFrontendError) -> Self {