Enum doku::json::Layout [−][src]
Expand description
Determines whether the document should contain one or two columns.
Variants
Prints types and comments inline, in a single chunk of text:
use doku::Document;
#[derive(Document)]
struct Person {
/// First name
/// (aka forename)
fname: String,
/// Last name
/// (aka surname)
lname: String,
}
let fmt = doku::json::Formatting {
layout: doku::json::Layout::OneColumn,
..Default::default()
};
let doc = doku::to_json_fmt::<Person>(&fmt);
doku::assert_doc!(r#"
{
// First name
// (aka forename)
"fname": "string",
// Last name
// (aka surname)
"lname": "string"
}
"#, doc);
Prints types and comments in two separate columns.
use doku::Document;
#[derive(Document)]
struct Person {
/// First name
/// (aka forename)
fname: String,
/// Last name
/// (aka surname)
lname: String,
}
let fmt = doku::json::Formatting {
layout: doku::json::Layout::TwoColumns {
align: true,
spacing: 1,
},
..Default::default()
};
let doc = doku::to_json_fmt::<Person>(&fmt);
doku::assert_doc!(r#"
{
"fname": "string", // First name
// (aka forename)
"lname": "string" // Last name
// (aka surname)
}
"#, doc);
Fields of TwoColumns
align: bool
Whether the two columns should be aligned or not:
use doku::Document;
#[derive(Document)]
struct Person {
/// First name
/// (aka forename)
fname: String,
/// Last name
/// (aka surname)
lname: String,
}
let fmt = doku::json::Formatting {
layout: doku::json::Layout::TwoColumns {
align: false,
spacing: 1,
},
..Default::default()
};
let doc = doku::to_json_fmt::<Person>(&fmt);
doku::assert_doc!(r#"
{
"fname": "string", // First name
// (aka forename)
"lname": "string" // Last name
// (aka surname)
}
"#, doc);
spacing: usize
Size of the horizontal spacing between both columns:
use doku::Document;
#[derive(Document)]
struct Person {
/// First name
/// (aka forename)
fname: String,
/// Last name
/// (aka surname)
lname: String,
}
let fmt = doku::json::Formatting {
layout: doku::json::Layout::TwoColumns {
align: true,
spacing: 5,
},
..Default::default()
};
let doc = doku::to_json_fmt::<Person>(&fmt);
doku::assert_doc!(r#"
{
"fname": "string", // First name
// (aka forename)
"lname": "string" // Last name
// (aka surname)
}
"#, doc);
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Layout
impl UnwindSafe for Layout
Blanket Implementations
Mutably borrows from an owned value. Read more