Skip to content

Commit 50c2044

Browse files
committed
Add docs for json feature, make frontend error pub
- Build all features on docs.rs - Add a `docsrs` cfg attr and add to items that are public but only when the json feature is enabled - Make the `JsonFrontendError` type nameable, this type is referred to in a public variant of `Error` but was not accessible outside the crate. Signed-off-by: Ross MacArthur <[email protected]>
1 parent c3cf77d commit 50c2044

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Upcoming Release
22

3+
- [[#91]](https://github.com/rust-vmm/seccompiler/pull/91): Actually make
4+
`JsonFrontendError` type publicly accessible, this type is referred to in a
5+
public variant of `Error` but was not accessible outside the crate.
6+
37
# v0.5.0
48

59
## Added

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ keywords = ["seccomp", "jail", "sandbox"]
99
license = "Apache-2.0 OR BSD-3-Clause"
1010
edition = "2021"
1111

12+
[package.metadata.docs.rs]
13+
all-features = true
14+
rustdoc-args = ["--cfg", "docsrs"]
15+
1216
[features]
1317
json = ["serde", "serde_json"]
1418

src/frontend/json.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use serde::{Deserialize, Deserializer};
3131
type Result<T> = result::Result<T, Error>;
3232

3333
/// Error compiling JSON into IR.
34+
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
3435
#[derive(Debug)]
3536
pub enum Error {
3637
/// Backend error creating the `SeccompFilter` IR.

src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@
185185
//! [`SeccompRule`]: struct.SeccompRule.html
186186
//! [`SeccompAction`]: enum.SeccompAction.html
187187
188+
#![cfg_attr(docsrs, feature(doc_cfg))]
189+
188190
mod backend;
189191
#[cfg(feature = "json")]
190192
mod frontend;
@@ -200,8 +202,11 @@ use std::collections::HashMap;
200202
use std::fmt::{Display, Formatter};
201203
use std::io;
202204

205+
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
206+
#[cfg(feature = "json")]
207+
pub use frontend::json::Error as JsonFrontendError;
203208
#[cfg(feature = "json")]
204-
use frontend::json::{Error as JsonFrontendError, JsonCompiler};
209+
use frontend::json::JsonCompiler;
205210

206211
// Re-export the IR public types.
207212
pub use backend::{
@@ -238,6 +243,7 @@ pub enum Error {
238243
/// of the thread that caused the failure.
239244
ThreadSync(libc::c_long),
240245
/// Json Frontend Error.
246+
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
241247
#[cfg(feature = "json")]
242248
JsonFrontend(JsonFrontendError),
243249
}
@@ -295,6 +301,7 @@ impl From<BackendError> for Error {
295301
Self::Backend(value)
296302
}
297303
}
304+
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
298305
#[cfg(feature = "json")]
299306
impl From<JsonFrontendError> for Error {
300307
fn from(value: JsonFrontendError) -> Self {

0 commit comments

Comments
 (0)